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
=== modified file 'bzrlib/smart/'
--- bzrlib/smart/ 2010-11-16 06:06:11 +0000
+++ bzrlib/smart/ 2011-09-01 15:13:24 +0000
@@ -236,7 +236,7 @@
236 next_revs = set()236 next_revs = set()
237 break237 break
238 # don't query things we've already queried238 # don't query things we've already queried
239 next_revs.difference_update(queried_revs)239 next_revs = next_revs.difference(queried_revs)
240 first_loop_done = True240 first_loop_done = True
242 # sorting trivially puts lexographically similar revision ids together.242 # sorting trivially puts lexographically similar revision ids together.
=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- doc/en/release-notes/bzr-2.3.txt 2011-08-20 09:28:27 +0000
+++ doc/en/release-notes/bzr-2.3.txt 2011-09-01 15:13:24 +0000
@@ -87,6 +87,11 @@
87.. Improvements to existing commands, especially improved performance 87.. Improvements to existing commands, especially improved performance
88 or memory usage, or better results.88 or memory usage, or better results.
90* Tweak an RPC implementation for ``Repository.get_parent_map``, it was
91 doing an inefficient ``small_set.difference_update(large_set)`` when we
92 can do ``small_set = small_set.difference(large_set)``. This speeds up
93 discovery time by about 10%. (John Arbash Meinel)
90Bug Fixes95Bug Fixes


People subscribed via source and target branches