Merge lp:~jameinel/bzr/2.3-get-parent-map-faster into lp:bzr/2.3

Proposed by John A Meinel on 2011-09-01
Status: Merged
Approved by: Jelmer Vernooij on 2011-09-01
Approved revision: 5654
Merged at revision: 5662
Proposed branch: lp:~jameinel/bzr/2.3-get-parent-map-faster
Merge into: lp:bzr/2.3
Diff against target: 27 lines (+6/-1)
2 files modified
bzrlib/smart/ (+1/-1)
doc/en/release-notes/bzr-2.3.txt (+5/-0)
To merge this branch: bzr merge lp:~jameinel/bzr/2.3-get-parent-map-faster
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) 2011-09-01 Approve on 2011-09-01
Review via email:

Commit message

Speed up ``Repository.get_parent_map`` by about 10%.

Description of the change

This is just a quick drive-by fix that I discovered while playing with Repository.get_parent_map.

This is a server-side fix. It just changes one line from:


small_set = small_set.difference(large_set)

The former always has to iterate all of its parameter, while the later can notice that 'small_set' is smaller, and do a [x for x in small if x not in large]

Using the improved client, it drops the time from about 26s down to about 23s. Which is 10-15% of the time spent discovering. Not world changing, but a very easy fix, as well. The time spent without my get_parent_map client fixes is about 158s down to 155s. So still about 3s overall.

Much more of an issue with the new code, though. :)

To post a comment you must log in.
Jelmer Vernooij (jelmer) :
review: Approve
John A Meinel (jameinel) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/smart/'
2--- bzrlib/smart/ 2010-11-16 06:06:11 +0000
3+++ bzrlib/smart/ 2011-09-01 15:13:24 +0000
4@@ -236,7 +236,7 @@
5 next_revs = set()
6 break
7 # don't query things we've already queried
8- next_revs.difference_update(queried_revs)
9+ next_revs = next_revs.difference(queried_revs)
10 first_loop_done = True
12 # sorting trivially puts lexographically similar revision ids together.
14=== modified file 'doc/en/release-notes/bzr-2.3.txt'
15--- doc/en/release-notes/bzr-2.3.txt 2011-08-20 09:28:27 +0000
16+++ doc/en/release-notes/bzr-2.3.txt 2011-09-01 15:13:24 +0000
17@@ -87,6 +87,11 @@
18 .. Improvements to existing commands, especially improved performance
19 or memory usage, or better results.
21+* Tweak an RPC implementation for ``Repository.get_parent_map``, it was
22+ doing an inefficient ``small_set.difference_update(large_set)`` when we
23+ can do ``small_set = small_set.difference(large_set)``. This speeds up
24+ discovery time by about 10%. (John Arbash Meinel)
26 Bug Fixes
27 *********


People subscribed via source and target branches