Opened 9 years ago
Last modified 9 years ago
#11868 closed enhancement
Cache Environment.get_known_users — at Version 2
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.3 |
Component: | general | Version: | |
Severity: | normal | Keywords: | environment |
Cc: | Steffen Hoffmann, trac@…, leho@… | Branch: | |
Release Notes: |
|
||
API Changes: |
Removed the overridden method |
||
Internal Changes: |
Description
The list of known users returned by Environment.get_known_users
should be cached.
Change History (3)
comment:2 by , 9 years ago
Proposed changes in log:rjollos.git:t11868, based on the branch from #11867.
I considered fixing this on 1.0-stable. Let me know any thoughts on that. I get the following results with attachment:test_get_known_users.py:
Num Users | Time w/o caching | First retrieval with caching | Retrieval from cache |
1k | 7 ms | 12 ms | < 1 ms |
10k | 70 ms | 120 ms | < 1 ms |
100k | 800 - 900 ms | 1200 ms | < 5 ms |
Not surprisingly it scales linearly with number of users.
by , 9 years ago
Attachment: | test_get_known_users.py added |
---|
The
get_known_users
method added toEnvironmentStub
in [2799] looks like an unnecessary override that makes it difficult to test the true behaviour ofget_known_users
. It's straightforward to modify the tests to make the override unnecessary.Removing the override is an API change; if anyone has concerns about that I can probably find a way to keep some backwards compatibility. A search of t-h.o reveals only one use of
EnvironmentStub.known_users
: browser:/tracformsplugin/trunk/0.11/tracforms/formdb.py@11137:418#L414.