Project

General

Profile

Actions

Patch #23378

closed

Speedup Project Settings with many members

Added by Victor Campos over 8 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Performance
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Hi,
There is a .sort in _members.html.erb partial that take a lot of time for project that have more than 12s to execute, so I change for .order('roles.builtin, roles.position, users.firstname, users.lastname')

- members = @project.memberships.active.includes(:member_roles, :roles, :principal).to_a.sort
+ members = @project.memberships.active.includes(:member_roles, :roles, :principal).order('roles.builtin, roles.position, users.firstname, users.lastname')
Benchmark.measure { project.memberships.active.includes(:member_roles, :roles, :principal).order('roles.builtin, roles.position, users.firstname, users.lastname').to_a }

#<Benchmark::Tms:0x00000008a427e0 @label="", @real=0.7370121359999757, @cstime=0.0, @cutime=0.0, @stime=0.0, @utime=0.6500000000000004, @total=0.6500000000000004>

Benchmark.measure { project.memberships.active.includes(:member_roles, :roles, :principal).to_a.sort }

#<Benchmark::Tms:0x0000000c68f450 @label="", @real=12.094179325009463, @cstime=0.0, @cutime=0.0, @stime=0.019999999999999962, @utime=12.029999999999998, @total=12.049999999999997>
Actions

Also available in: Atom PDF