Univention Bugzilla – Bug 41999
Quadratic scaling in s4cache.py (speed up _update_entry)
Last modified: 2016-09-29 17:31:06 CEST
Created attachment 7871 [details]
Patch against r71582 UCS 4.1-2, but will probably work with many other versions
The attached patch adds indexes to enable efficient lookup
by data.guid_id (and data.attribute_id) (as used
by attributes.attribute (as used
by guids.guid (as used
to the SQLite database of the S4Cache, if they do not already exist, during __init__().
Otherwise more objects lead to more work per object, i.e. quadratic complexity.
Customer reported speedup from 10s of seconds per object to 10s of objects per second.
Additionally the patch adds indexes to enable efficient lookup
by s4_lock.guid (as used
by ucs_lock.uuid (as used
to the SQLite database of the LockingDB, if they do not already exist, during __init__().
Otherwise more locks lead to more work per lock, i.e. quadratic complexity.
Finally I note that
self.s4cache in LockingDB.__init__() seems like dead code
self.s4cache in S4Cache.__init__() and .add_entry() seems like unused code or a waste of memory
Code review 4.1-3 (r71908): OK
Code review 4.2 (r71909): OK