Modify

Opened 5 years ago

Last modified 10 months ago

#9606 new defect

Rendering slow when having lots of custom fields and rules

Reported by: jbeilicke Owned by: robguttman
Priority: normal Component: DynamicFieldsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

The plugin works like a charm in general. Unfortunately, the rendering of a ticket takes about 10s in Chrome 16 (and even more in FF) when having about 45 custom fields that should be hidden or displayed depending on components and ticket types.

According to some quick tests, the performance issue might be caused by several nested $.each() in dynfields.html, one time in the function apply_rules() and in the jQuery(document).ready() part.

Do you see any chance that this part might be refactored to improve the performance?

Attachments (1)

ticket-custom.txt (23.9 KB) - added by theaob 11 months ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 5 years ago by jbeilicke

I've investigated the issue further:

  • Replaced jQuery.each() with native JavaScript for-loops: No performance gain.
  • Set some console.time() measuring points: It turned out that moving each field in the DOM triggered in layout.js causes the slow-down.

comment:2 Changed 5 years ago by robguttman

jbeilicke, really appreciate you investigating performance issues here. I admit I have not concerned myself with performance oprimizations as I haven't personally seen problems - but then I have a lot less fields than you do it seems.

Let me know what you find in your profiling and I'll be happy to attempt fixes accordingly.

comment:3 Changed 11 months ago by theaob

Sorry to rise this ticket from the dead. I have the same issue. I have a trac 1.0.8 installed on a ubuntu machine with DynamicFields 1.2.6 installed (compiled from latest revisions 0.11 folder). I have more than 100 custom fields with 30 ticket types. Each field has its own rule. Even loading the new ticket page takes about 30 seconds on a modern machine. And when a user selects a different type of ticket, it takes close to 20 seconds to reload. I assume automatic ticket preview feature also effects this but I mainly think there are some inefficiencies in the js code. Disabling Rules doesn't seem to speed up the page loading. I'd be happy to provide more detail to solve this problem.

Also we used to have a 1.0.1 installed on a mac with DynamicFields 1.2.1 installed. Somehow the plugin works faster with that configuration (same field & ticket types). I'm suspecting the underlying DOM operations for this problem since on 1.2.1, fields disappear after the rendering of the page.

Last edited 11 months ago by rjollos (previous) (diff)

comment:4 Changed 11 months ago by rjollos

You might want to try installing from the trunk. The 0.11 branch is unlikely to be maintained going forward.

comment:5 Changed 11 months ago by theaob

Just compiled from trunk and installed. The problem still exists.

comment:6 Changed 11 months ago by rjollos

I'm not sure that I'll have time to take a look at this. However, attaching your [ticket-custom] section would greatly help in reproducing the issue. It sounds like the section is large, so please attach it as a file rather than pasting in a comment.

The output of trac-admin $env ticket_type list would also be useful. You can just paste that as a comment.

Last edited 11 months ago by rjollos (previous) (diff)

Changed 11 months ago by theaob

comment:7 Changed 11 months ago by theaob

I've attached the [ticket-custom] field. Also here are the ticket types:

Sorun               
Test                
EGGIM               
MeetingAI           
UcusTalimati        
YDI                 
UcusAI              
UretimITF           
ACGIM               
InfEGG              
CodeIssue           
LeasonsLearned      
IntegrationIssue    
ToolIssue           
TestIssue           
IsTakibi            
Gereksinim          
YGT                 
Task                
TestTalimati        
AYESAS_FIX          
AYESAS_PLAN         
ComponentDescription
CAWS                
KarayelUcusAI       
Açıklama            
SahaTalep           
SesliUyari          
Release   

comment:8 Changed 11 months ago by rjollos

In 14895:

2.2.0dev: Trivial optimizations and code style changes suggested by linter. Refs #9606.

comment:9 Changed 11 months ago by theaob

Your latest commit somewhat improved rendering times but still locks the browser.

comment:10 Changed 11 months ago by rjollos

In 14896:

2.2.0dev: Move functions inside document ready handler. Refs #9606.

No performance change is expected.

comment:11 Changed 11 months ago by rjollos

In 14897:

2.2.0dev: Minor selector optimizations. Refs #9606.

comment:12 Changed 11 months ago by rjollos

Looks like 90% of the time is being spent in order_fields. I'll try to look into improving that, but it will be at least a few days before I have time.

comment:13 Changed 11 months ago by rjollos

In 14898:

2.2.0dev: Minor selector optimization. Refs #9606.

comment:14 Changed 10 months ago by rjollos

In 14905:

2.2.0dev: Fix errors in [14896].

The functions get_selector, apply_rules and setup_triggers needs to be global scope.

Refs #9606.

comment:15 Changed 10 months ago by rjollos

In 14906:

2.2.0dev: Use jQuery is to compare element type.

Refs #9606.

Add Comment

Modify Ticket

Action
as new The owner will remain robguttman.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.