[RFC] tsort.MergeSorter uses __slots__

John Arbash Meinel john at arbash-meinel.com
Thu Apr 19 00:25:34 BST 2007


I was working nearby and I had cause to profile merge_sort.

It seemed that _push_node() and _pop_node() were taking a lot longer
than they should (though I was accidentally reading TopoSorter instead).

So I added __slots__, and it turns out to be quite a bit faster.

On my machine doing list(merge_sort()) for all of bzr.dev changes from
taking ~705ms to taking 600ms. (~15% improvement).

This is a rather simple change for such a big improvement, so it seems
reasonable to merge it.

John
=:->
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: merge_sort.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070418/43ba1844/attachment.diff 


More information about the bazaar mailing list