Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 23724:aafeaba22826 stable
revset: drop pre-lazyset optimization for stringset of subset == entire repo
It was introduced at e44ebd2a142a, where spanset.__contains__() did not exist.
Nowadays, we have to pay huge penalty for len(subset).
The following example showed that OR operation could be O(n * m^2)
(n: len(repo), m: number of OR operators, m >= 2) probably because of
filteredset.__len__.
revset #0: 0|1|2|3|4|5|6|7|8|9
0) wall 8.092713 comb 8.090000 user 8.090000 sys 0.000000 (best of 3)
1) wall 0.445354 comb 0.450000 user 0.430000 sys 0.020000 (best of 22)
2) wall 0.000389 comb 0.000000 user 0.000000 sys 0.000000 (best of 7347)
(0: 3.2.4, 1: 3.1.2, 2: this patch)
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Jan 2015 10:25:08 +0900 |
parents | 0c432696dae3 |
children | d944492445fa c90d195320c5 |
comparison
equal
deleted
inserted
replaced
23721:1b3df5ef5949 | 23724:aafeaba22826 |
---|---|
253 | 253 |
254 def stringset(repo, subset, x): | 254 def stringset(repo, subset, x): |
255 x = repo[x].rev() | 255 x = repo[x].rev() |
256 if x == -1 and len(subset) == len(repo): | 256 if x == -1 and len(subset) == len(repo): |
257 return baseset([-1]) | 257 return baseset([-1]) |
258 if len(subset) == len(repo) or x in subset: | 258 if x in subset: |
259 return baseset([x]) | 259 return baseset([x]) |
260 return baseset() | 260 return baseset() |
261 | 261 |
262 def symbolset(repo, subset, x): | 262 def symbolset(repo, subset, x): |
263 if x in symbols: | 263 if x in symbols: |