Merge lp://staging/~jameinel/loggerhead/tag_cache into lp://staging/loggerhead

Proposed by John A Meinel
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~jameinel/loggerhead/tag_cache
Merge into: lp://staging/loggerhead
Diff against target: 27 lines (+5/-3)
1 file modified
loggerhead/history.py (+5/-3)
To merge this branch: bzr merge lp://staging/~jameinel/loggerhead/tag_cache
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+24170@code.staging.launchpad.net

Description of the change

Another performance tweak. With the other patches I just proposed, this changes:

  emacs/trunk/changes 0.315s => 0.245s

The issue is that calling Branch.tags.get_reverse_tag_dict() doesn't cache the result. It goes out and re-reads the tags file each time, deserializes it, and produces a reverse-mapping.

It depends how many tags a branch has, but in the case of emacs, there are ~1,100 tags. And this was getting called for every revision being displayed in 'changes'. So 20 revs *1.1k tags getting deserialized.

It still happens 1 time per HTTP request, but at least it isn't 20 times.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Seems like a simple clear win to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches