hg
author Pierre-Yves David <pierre-yves.david@fb.com>
Mon, 28 Apr 2014 15:15:36 -0700
branchstable
changeset 21204 1d7a2771aa36
parent 14233 659f34b833b9
child 21812 73e4a02e6d23
permissions -rwxr-xr-x
revset: inline spanset containment check (fix perf regression) Calling a function is super expensive in python. We inline the trivial range comparison to get back to more sensible performance on common revset operation. Benchmark result below: Revision mapping: 0) 3f83fc5cfe71 2.9.2 release 1) bcfd44abad93 current @ 2) This revision revset #0: public() 0) wall 0.010890 comb 0.010000 user 0.010000 sys 0.000000 (best of 201) 1) wall 0.012109 comb 0.010000 user 0.010000 sys 0.000000 (best of 199) 2) wall 0.012211 comb 0.020000 user 0.020000 sys 0.000000 (best of 197) revset #1: :10000 and public() 0) wall 0.007141 comb 0.010000 user 0.010000 sys 0.000000 (best of 361) 1) wall 0.014139 comb 0.010000 user 0.010000 sys 0.000000 (best of 186) 2) wall 0.008334 comb 0.010000 user 0.010000 sys 0.000000 (best of 308) revset #2: draft() 0) wall 0.009610 comb 0.010000 user 0.010000 sys 0.000000 (best of 279) 1) wall 0.010942 comb 0.010000 user 0.010000 sys 0.000000 (best of 243) 2) wall 0.011036 comb 0.010000 user 0.010000 sys 0.000000 (best of 239) revset #3: :10000 and draft() 0) wall 0.006852 comb 0.010000 user 0.010000 sys 0.000000 (best of 383) 1) wall 0.014641 comb 0.010000 user 0.010000 sys 0.000000 (best of 183) 2) wall 0.008314 comb 0.010000 user 0.010000 sys 0.000000 (best of 299) We can see this changeset gains back the regression for `and` operation on spanset. We are still a bit slowerfor the `public()` and `draft()`. Predicates not touched by this changeset.

#!/usr/bin/env python
#
# mercurial - scalable distributed SCM
#
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

import os
import sys

libdir = '@LIBDIR@'

if libdir != '@' 'LIBDIR' '@':
    if not os.path.isabs(libdir):
        libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                              libdir)
        libdir = os.path.abspath(libdir)
    sys.path.insert(0, libdir)

# enable importing on demand to reduce startup time
try:
    from mercurial import demandimport; demandimport.enable()
except ImportError:
    import sys
    sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
                     ' '.join(sys.path))
    sys.stderr.write("(check your install and PYTHONPATH)\n")
    sys.exit(-1)

import mercurial.util
import mercurial.dispatch

for fp in (sys.stdin, sys.stdout, sys.stderr):
    mercurial.util.setbinary(fp)

mercurial.dispatch.run()