~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-04 04:33:24 UTC
  • mto: This revision was merged to the branch mainline in revision 5390.
  • Revision ID: john@arbash-meinel.com-20100804043324-1ldc2v2w1kza7ox4
get into the nitty gritty for the _key_to_sha1 function.

It doesn't seem to help to op-out of the actual unhexlify call, so at least
that doesn't seem to be the performance overhead.
We get down to around 19.9us for _key_to_sha1 across 120 keys, which is
0.166us per key.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
1685
1685
    def __init__(self, graph):
1686
1686
        self._graph = graph
1687
1687
 
 
1688
    def topo_sort(self):
 
1689
        return [r for (r,) in self._graph.topo_sort()]
 
1690
 
1688
1691
    def heads(self, ids):
1689
1692
        """See Graph.heads()"""
1690
1693
        as_keys = [(i,) for i in ids]
1691
1694
        head_keys = self._graph.heads(as_keys)
1692
1695
        return set([h[0] for h in head_keys])
1693
1696
 
 
1697
    def merge_sort(self, tip_revision):
 
1698
        return self._graph.merge_sort((tip_revision,))
 
1699
 
1694
1700
 
1695
1701
_counters = [0,0,0,0,0,0,0]
1696
1702
try: