Mercurial > hg-stable
view hg @ 31040:2d1bf84046f6
smartset: use native set operations as fast paths
For set operations like "&" and "-", where we know both basesets have their
sets ready, and the first set is sorted, use the native Python set
operations as a fast path.
Note: "+" is not optimized as that will break the ordering.
This leads to noticeable improvements on performance:
revset | before | after | delta
----------------------------------------------------------------
draft() & draft() & draft() & draft() | 776 | 477 | -39%
draft() + draft() + draft() + draft() | 2849 | 2864 |
draft() - draft() + draft() - draft() | 943 | 240 | -75%
draft() - draft() - draft() - draft() | 557 | 197 | -64%
(time measured in microseconds)
author | Jun Wu <quark@fb.com> |
---|---|
date | Sat, 18 Feb 2017 17:23:43 -0800 |
parents | 1f5052d35b30 |
children | b4810bf95c03 |
line wrap: on
line source
#!/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 if os.environ.get('HGUNICODEPEDANTRY', False): try: reload(sys) sys.setdefaultencoding("undefined") except NameError: pass 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: if sys.version_info[0] < 3: from mercurial import demandimport; demandimport.enable() except ImportError: 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()