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
131 131 try: 132 132 if env_path not in self._plugin_domains: 133 133 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)) 135 136 finally: 136 137 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)
Change History (6)
by , 13 years ago
Attachment: | before.png added |
---|
by , 13 years ago
comment:1 by , 13 years ago
Milestone: | → 0.12.3 |
---|---|
Owner: | set to |
comment:2 by , 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?
Good catch, and excellent analysis. Thank you for the bug report.