equal
deleted
inserted
replaced
67 try: |
67 try: |
68 from mercurial import pycompat |
68 from mercurial import pycompat |
69 getargspec = pycompat.getargspec # added to module after 4.5 |
69 getargspec = pycompat.getargspec # added to module after 4.5 |
70 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede) |
70 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede) |
71 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b) |
71 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b) |
|
72 if pycompat.ispy3: |
|
73 _maxint = sys.maxsize # per py3 docs for replacing maxint |
|
74 else: |
|
75 _maxint = sys.maxint |
72 except (ImportError, AttributeError): |
76 except (ImportError, AttributeError): |
73 import inspect |
77 import inspect |
74 getargspec = inspect.getargspec |
78 getargspec = inspect.getargspec |
|
79 _maxint = sys.maxint # no py3 support |
75 _sysstr = lambda x: x # no py3 support |
80 _sysstr = lambda x: x # no py3 support |
76 _xrange = xrange |
81 _xrange = xrange |
77 |
82 |
78 try: |
83 try: |
79 # 4.7+ |
84 # 4.7+ |
1892 |
1897 |
1893 costrange = list(range(mincost, maxcost + 1)) |
1898 costrange = list(range(mincost, maxcost + 1)) |
1894 |
1899 |
1895 values = [] |
1900 values = [] |
1896 for i in _xrange(size): |
1901 for i in _xrange(size): |
1897 values.append(random.randint(0, sys.maxint)) |
1902 values.append(random.randint(0, _maxint)) |
1898 |
1903 |
1899 # Get mode fills the cache and tests raw lookup performance with no |
1904 # Get mode fills the cache and tests raw lookup performance with no |
1900 # eviction. |
1905 # eviction. |
1901 getseq = [] |
1906 getseq = [] |
1902 for i in _xrange(gets): |
1907 for i in _xrange(gets): |
1923 |
1928 |
1924 # Set mode tests insertion speed with cache eviction. |
1929 # Set mode tests insertion speed with cache eviction. |
1925 setseq = [] |
1930 setseq = [] |
1926 costs = [] |
1931 costs = [] |
1927 for i in _xrange(sets): |
1932 for i in _xrange(sets): |
1928 setseq.append(random.randint(0, sys.maxint)) |
1933 setseq.append(random.randint(0, _maxint)) |
1929 costs.append(random.choice(costrange)) |
1934 costs.append(random.choice(costrange)) |
1930 |
1935 |
1931 def doinserts(): |
1936 def doinserts(): |
1932 d = util.lrucachedict(size) |
1937 d = util.lrucachedict(size) |
1933 for v in setseq: |
1938 for v in setseq: |