revset-node: speedup by a few hundred fold
Instead of checking all elements of the subset against a single rev, just check
if this rev is in the subset. The old way was inherited from when the subset was
a list.
Non surprise, this provide massive speedup.
id("
d82e2223f132")
before) wall 0.008205 comb 0.000000 user 0.000000 sys 0.000000 (best of 302)
after) wall 0.000069 comb 0.000000 user 0.000000 sys 0.000000 (best of 34518)
revset #1: public() and id("
d82e2223f132")
before) wall 0.019763 comb 0.020000 user 0.020000 sys 0.000000 (best of 124)
after) wall 0.000101 comb 0.000000 user 0.000000 sys 0.000000 (best of 20130)
# strutil.py - string utilities for Mercurial
#
# Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
def findall(haystack, needle, start=0, end=None):
if end is None:
end = len(haystack)
if end < 0:
end += len(haystack)
if start < 0:
start += len(haystack)
while start < end:
c = haystack.find(needle, start, end)
if c == -1:
break
yield c
start = c + 1
def rfindall(haystack, needle, start=0, end=None):
if end is None:
end = len(haystack)
if end < 0:
end += len(haystack)
if start < 0:
start += len(haystack)
while end >= 0:
c = haystack.rfind(needle, start, end)
if c == -1:
break
yield c
end = c - 1