70
70
from cStringIO import StringIO
73
from brzlib.lazy_import import lazy_import
73
from breezy.lazy_import import lazy_import
74
74
lazy_import(globals(), """
75
from brzlib import tsort
75
from breezy import tsort
81
from brzlib.errors import (WeaveError, WeaveFormatError, WeaveParentMismatch,
81
from breezy.errors import (WeaveError, WeaveFormatError, WeaveParentMismatch,
82
82
RevisionAlreadyPresent,
83
83
RevisionNotPresent,
84
84
UnavailableRepresentation,
86
from brzlib.osutils import dirname, sha, sha_strings, split_lines
87
import brzlib.patiencediff
88
from brzlib.revision import NULL_REVISION
89
from brzlib.symbol_versioning import *
90
from brzlib.trace import mutter
91
from brzlib.versionedfile import (
86
from breezy.osutils import dirname, sha, sha_strings, split_lines
87
import breezy.patiencediff
88
from breezy.revision import NULL_REVISION
89
from breezy.symbol_versioning import *
90
from breezy.trace import mutter
91
from breezy.versionedfile import (
92
92
AbsentContentFactory,
95
95
sort_groupcompress,
98
from brzlib.weavefile import _read_weave_v5, write_weave_v5
98
from breezy.weavefile import _read_weave_v5, write_weave_v5
101
101
class WeaveContentFactory(ContentFactory):
688
688
WFE = WeaveFormatError
691
# 449 0 4474.6820 2356.5590 brzlib.weave:556(_extract)
691
# 449 0 4474.6820 2356.5590 breezy.weave:556(_extract)
692
692
# +285282 0 1676.8040 1676.8040 +<isinstance>
693
693
# 1.6 seconds in 'isinstance'.
694
694
# changing the first isinstance:
695
# 449 0 2814.2660 1577.1760 brzlib.weave:556(_extract)
695
# 449 0 2814.2660 1577.1760 breezy.weave:556(_extract)
696
696
# +140414 0 762.8050 762.8050 +<isinstance>
697
697
# note that the inline time actually dropped (less function calls)
698
698
# and total processing time was halved.
699
699
# we're still spending ~1/4 of the method in isinstance though.
700
700
# so lets hard code the acceptable string classes we expect:
701
# 449 0 1202.9420 786.2930 brzlib.weave:556(_extract)
701
# 449 0 1202.9420 786.2930 breezy.weave:556(_extract)
702
702
# +71352 0 377.5560 377.5560 +<method 'append' of 'list'
704
704
# yay, down to ~1/4 the initial extract time, and our inline time
705
705
# has shrunk again, with isinstance no longer dominating.
706
706
# tweaking the stack inclusion test to use a set gives:
707
# 449 0 1122.8030 713.0080 brzlib.weave:556(_extract)
707
# 449 0 1122.8030 713.0080 breezy.weave:556(_extract)
708
708
# +71352 0 354.9980 354.9980 +<method 'append' of 'list'
710
710
# - a 5% win, or possibly just noise. However with large istacks that