Edgewall Software
Modify

Opened 13 years ago

Closed 13 years ago

#10294 closed defect (fixed)

Trac's response time is late when the update of trac.ini increases

Reported by: wadatka Owned by: Remy Blank
Priority: normal Milestone: 0.12.3
Component: general Version: 0.12.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Trac's response time is late when the update of trac.ini increases

Trac's response time is late when the update of trac.ini increases.
I measured the response time of wiki top page in 2 cases.

  • After Trac start : 1.372sec
  • After 200 time update of trac.ini : 10.96sec

Trac Profiling result in this 2 cases.

  • After Trac start : before.png
  • After 200 time update of trac.ini : after.png

Execution frequency of load method increases 14 times to 1900 times.
This load method is called from the activate method of translation.py.
The call frequency of the load method depends on the size of list of plug-in domain (_plugin_domains).

When plug-in additional processing is executed whenever the update of the trac.ini file starts, and the same plug-in already exists in the list, the list of a plug-in domain is added.
Therefore, the size of the list increases, too, as the update frequency increases.

The following patch fixes this issue:

  • trac/util/translation.py

     
    131131            try:
    132132                if env_path not in self._plugin_domains:
    133133                    self._plugin_domains[env_path] = []
    134                 self._plugin_domains[env_path].append((domain, locales_dir))
     134                if (domain, locales_dir) not in self._plugin_domains[env_path]:
     135                    self._plugin_domains[env_path].append((domain, locales_dir))
    135136            finally:
    136137                self._plugin_domains_lock.release()

System Infomation

Trac 0.12.1
Babel 0.9.5
CustomFieldAdmin 0.2.5
Docutils 0.7
Genshi 0.6
mod_python 3.3.1
MySQL server: "5.1.41-community-log", client: "5.0.27", thread-safe: 1
MySQLdb 1.2.2
Pygments 1.3.1
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]
RPC 1.0.6
setuptools 0.6c11
Subversion 1.6.6 (r40053)
jQuery: 1.4.2

Attachments (2)

before.png (262.3 KB ) - added by wadatka 13 years ago.
after.png (224.7 KB ) - added by wadatka 13 years ago.

Download all attachments as: .zip

Change History (6)

by wadatka, 13 years ago

Attachment: before.png added

by wadatka, 13 years ago

Attachment: after.png added

comment:1 by Remy Blank, 13 years ago

Milestone: 0.12.3
Owner: set to Remy Blank

Good catch, and excellent analysis. Thank you for the bug report.

comment:2 by Remy Blank, 13 years ago

Fix applied in [10773]. However, I wonder if it wouldn't be appropriate to use a set() here instead of a list for plugin domains. Is the order of the entries significant? Or even a dict(), using the domain as the key and the directory as a value. Does it make sense to have more than one directory for a domain?

comment:3 by Christian Boos, 13 years ago

Using a dict should fine, I think.

comment:4 by Remy Blank, 13 years ago

Resolution: fixed
Status: newclosed

Done in [10777].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.