Merge lp:~tdfischer/zeitgeist/event-caching into lp:~zeitgeist/zeitgeist/bluebird
Proposed by
Trever Fischer
Status: | Needs review | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~tdfischer/zeitgeist/event-caching | ||||
Merge into: | lp:~zeitgeist/zeitgeist/bluebird | ||||
Diff against target: |
313 lines (+198/-5) 7 files modified
.bzrignore (+1/-0) extensions/fts++/Makefile.am (+1/-0) src/Makefile.am (+1/-0) src/db-reader.vala (+27/-5) src/event-cache.vala (+77/-0) test/direct/Makefile.am (+7/-0) test/direct/event-cache-test.vala (+84/-0) |
||||
To merge this branch: | bzr merge lp:~tdfischer/zeitgeist/event-caching | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Siegfried Gevatter | Needs Fixing | ||
Review via email: mp+97450@code.launchpad.net |
Description of the change
Implements a LRU cache for events, to reduce hitting the database on every request.
To post a comment you must log in.
Unmerged revisions
- 426. By Trever Fischer
-
style++, and use automatic array power of two allocation
- 425. By Trever Fischer
-
Fix handling of null events, and use a pre-sized GenericArray to reduce CRITICAL messages
- 424. By Trever Fischer
-
Remove the test binary that was accidentally committed
- 423. By Trever Fischer
-
Ignore the new test
- 422. By Trever Fischer
-
Add files I missed
- 421. By Trever Fischer
-
Implement LRU event cache
Hi Trever,
Nice work, thanks for working on this!
Some comments:
> max_cache_size = 1024;
We have a (so far unused) constant for this in src/utils.vala: Utils.CACHE_SIZE.
+ uncached_ ids.resize( uncached_ ids.length+ 1); ids[uncached_ ids.length- 1] = event_ids[i];
+ uncached_
You can use "+=" here (which looks nicer and does power-of-two allocations).
+ cache = new EventCache();
^ space
+ for(int i = 0; i < event_ids.length; i++)
^ space
And more spaces missing in function declarations in event-cache.vala.
Also, see the comment:
// TODO: Consider if we still want the cache. [...]
// It'd also benchmark it again first, we may have better options
// to enhance the performance of SQLite now, and event processing
// will be faster now being C.
Some numbers about how this affects performance for different queries (cold query vs hot query vs mixed query with and without cache).