Commit Graph

272 Commits

Author SHA1 Message Date
Lucas Moscovicz
b6ae0f9720 revset: added cached generated list on generatorset
This allows to iterate the generatorset more than once.
2014-02-12 18:45:49 -08:00
Lucas Moscovicz
e97b3cbf9e revset: fixed bug where log -f was taking too long to return 2014-02-21 13:16:17 -08:00
Lucas Moscovicz
bee2c6a618 revset: added generatorset class with cached __contains__ method 2014-02-05 15:23:11 -08:00
Lucas Moscovicz
cf5a2af3df revset: changed last implementation to use lazy classes
Instead of using getitem just reverse the revision list and get the first
'lim' elements. With classes like spanset which are easily reversible this
will work faster.

Performance Benchmarking:

$ time hg log -qr "last(all())"
...

real  0m0.569s
user  0m0.447s
sys 0m0.122s

$ time ./hg log -qr "last(all())"
...

real  0m0.215s
user  0m0.150s
sys 0m0.063s
2014-02-19 12:56:41 -08:00
Lucas Moscovicz
131799c6de revset: changed mfunc and getset to work with old style revset methods
Now extensions shouldn't break when adding new revsets.
2014-02-18 15:54:46 -08:00
Lucas Moscovicz
ba7cfe4ed4 revset: changed revsets to use spanset
Performance Benchmarking:

$ hg perfrevset "first(all())"
! wall 0.304936 comb 0.300000 user 0.280000 sys 0.020000 (best of 33)

$ ./hg perfrevset "first(all())"
! wall 0.175640 comb 0.180000 user 0.160000 sys 0.020000 (best of 56)
2014-02-03 10:15:15 -08:00
Lucas Moscovicz
6e0e0d512b revset: changed spanset to take a repo argument
This way, we can have by default the length of the repo as the end argument
and less code has to be aware of hidden revisions.
2014-02-18 11:38:03 -08:00
Lucas Moscovicz
4961b39b44 revset: changed spanset implementation to take hidden revisions into account
Hidden revisions are now excluded from the spanset.
Now this doesn't break for people using changeset evolution.
2014-02-10 17:38:43 -08:00
Lucas Moscovicz
3d8c71a8cc revset: added cache to lazysets
This allows __contains__ to return faster when asked for same value twice.
2014-02-04 15:31:57 -08:00
Siddharth Agarwal
2c51509bb0 revset: optimize missing ancestor expressions
A missing ancestor expression is any expression of the form (::x - ::y) or
equivalent. Such expressions are remarkably common, and so far have involved
multiple walks down the DAG, followed by a set difference operation.

With this patch, such expressions will be transformed into uses of the fast
algorithm at ancestor.missingancestor.

For a repository with over 600,000 revisions, perfrevset for '::tip - ::-10000'
returns:

Before: ! wall 3.999575 comb 4.000000 user 3.910000 sys 0.090000 (best of 3)
After:  ! wall 0.132423 comb 0.130000 user 0.130000 sys 0.000000 (best of 75)
2014-02-13 14:04:47 -08:00
Siddharth Agarwal
2a56880ad4 revset: add an undocumented _missingancestors function
This will be used in an upcoming patch to optimize expressions of the form
(::x - ::y).
2014-02-13 13:54:45 -08:00
Lucas Moscovicz
3a2188dac4 revset: added operations to spanset to duck type baseset
Added more operations which are not lazy but only used so far to duck type
baseset.
2014-02-06 15:56:25 -08:00
Lucas Moscovicz
e8f60a5520 revset: added basic operations to spanset
Added methods __add__, __sub__ and __and__ to duck type more methods in
baseset
2014-02-12 10:22:43 -08:00
Lucas Moscovicz
9ce7f8243d revset: added spanset class to represent revision ranges 2014-02-12 10:16:21 -08:00
Lucas Moscovicz
97db49c09a revset: added lazyset implementation to extra revset 2014-02-06 08:36:11 -08:00
Lucas Moscovicz
1d43685667 revset: added lazyset implementation to converted revset 2014-02-06 08:32:40 -08:00
Lucas Moscovicz
a871b2cef1 revset: added lazyset implementation to closed revset 2014-02-06 08:31:55 -08:00
Lucas Moscovicz
082b56b0fb revset: added lazyset implementation to contains revset 2014-02-04 15:07:03 -08:00
Lucas Moscovicz
7a6459e30d revset: added lazyset implementation to secret revset 2014-02-04 09:29:19 -08:00
Lucas Moscovicz
c27606d6ba revset: added lazyset implementation to matching revset
Performance Benchmarking:

$ time hg log -qr "first(matching(0))"
0:3a6a38229d41

real  0m2.213s
user  0m2.149s
sys 0m0.055s

$ time ./hg log -qr "first(matching(0))"
0:3a6a38229d41

real  0m0.177s
user  0m0.137s
sys 0m0.038s
2014-02-04 09:14:45 -08:00
Lucas Moscovicz
2f1f581a8c revset: added lazyset implementation to _matchfiles
Performance Benchmarking:

$ time hg log -qr "first(file(README))"
0:3a6a38229d41

real  0m2.234s
user  0m2.180s
sys 0m0.044s

$ time ./hg log -qr "first(file(README))"
0:3a6a38229d41

real  0m0.172s
user  0m0.129s
sys 0m0.042s
2014-02-04 08:51:07 -08:00
Lucas Moscovicz
3bfbd34602 revset: added lazyset implementation to checkstatus
This improves the performance of the revsets 'adds' 'modifies' and 'removes'

Performance benchmarking:

$ time hg log -qr "first(adds(README))"
0:3a6a38229d41

real  0m2.279s
user  0m2.222s
sys 0m0.053s

$ time ./hg log -qr "first(adds(README))"
0:3a6a38229d41

real  0m0.172s
user  0m0.131s
sys 0m0.041s

$ time hg log -qr "first(modifies(README))"
1:692bee203f23

real  0m2.292s
user  0m2.227s
sys 0m0.061s

$ time ./hg log -qr "first(modifies(README))"
1:692bee203f23

real  0m0.178s
user  0m0.130s
sys 0m0.038s

$ time hg log -qr "first(removes(README))"
2379:f24de2acd560

real  0m2.297s
user  0m2.235s
sys 0m0.058s

$ time ./hg log -qr "first(removes(README))"
2379:f24de2acd560

real  0m0.975s
user  0m0.797s
sys 0m0.056s
2014-01-31 10:47:51 -08:00
Lucas Moscovicz
8cb1ccfe44 revset: added lazyset implementation to public revset
Performance Benchmarking:

$ time hg log -qr "first(public())"
...

real  0m1.184s
user  0m1.051s
sys 0m0.130s

$ time ./hg log -qr "first(public())"
...

real  0m0.548s
user  0m0.427s
sys 0m0.118s
2014-01-30 17:46:08 -08:00
Lucas Moscovicz
69d62676c5 revset: added lazyset implementation to merge revset
Performance benchmarking:

$ time hg log -qr "first(merge())"
102:1634643e0cd8

real  0m0.276s
user  0m0.208s
sys 0m0.047s

$ time ./hg log -qr "first(merge())"
102:1634643e0cd8

real  0m0.192s
user  0m0.154s
sys 0m0.027s
2014-01-30 16:47:29 -08:00
Lucas Moscovicz
f18b7c26e0 revset: added lazyset implementation to grep revset
Performance benchmarking:

$ time hg log -qr "first(grep(hg))"
0:3a6a38229d41

real  0m2.214s
user  0m2.163s
sys 0m0.045s

$ time ./hg log -qr "first(grep(hg))"
0:3a6a38229d41

real  0m0.211s
user  0m0.146s
sys 0m0.035s
2014-01-30 16:03:18 -08:00
Lucas Moscovicz
ab42b4bbc5 revset: added lazyset implementation to desc revset
Performance benchmarking:

$ time hg log -qr "first(desc(hg))"
changeset:   0:3a6a38229d41

real  0m2.210s
user  0m2.158s
sys 0m0.049s

$ time ./hg log -qr "first(desc(hg))"
changeset:   0:3a6a38229d41

real  0m0.171s
user  0m0.131s
sys 0m0.035s
2014-01-30 15:39:56 -08:00
Lucas Moscovicz
6ba591c77e revset: added lazyset implementation to draft revset 2014-02-03 16:15:25 -08:00
Lucas Moscovicz
57e67b73a7 revset: added lazyset implementation bookmark revset 2014-01-29 15:23:16 -08:00
Lucas Moscovicz
28688b6d54 revset: added lazyset implementation to date revset
Performance Benchmarking:

$ time hg log -qr "first(date(05/03/2005))"
0:3a6a38229d41

real  0m3.157s
user  0m2.994s
sys 0m0.087s

$ time ./hg log -qr "first(date(05/03/2005))"
0:3a6a38229d41

real  0m0.509s
user  0m0.289s
sys 0m0.070s
2014-02-03 16:02:48 -08:00
Lucas Moscovicz
d80d16c98c revset: added lazyset implementation to author revset
Performance benchmarking:

$ time hg log -qr "first(author(mpm))"
0:3a6a38229d41

real  0m3.486s
user  0m3.317s
sys 0m0.077s

$ time ./hg log -qr "first(author(mpm))"
0:3a6a38229d41

real  0m0.551s
user  0m0.295s
sys 0m0.072s
2014-01-29 09:22:31 -08:00
Lucas Moscovicz
fe40abc599 revset: added lazyset implementation to keyword revset
Performance benchmarking:

$ time hg log -qr "first(keyword(changeset))"
0:3a6a38229d41

real  0m3.466s
user  0m3.345s
sys 0m0.072s

$ time ./hg log -qr "first(keyword(changeset))"
0:3a6a38229d41

real  0m0.365s
user  0m0.199s
sys 0m0.083s
2014-01-29 09:04:03 -08:00
Lucas Moscovicz
303bd9d554 revset: changed limit revset implementation to work with lazy revsets
Performance benchmarking:

$ time hg log -qr "first(branch(default))"
0:3a6a38229d41

real  0m3.130s
user  0m3.025s
sys 0m0.074s

$ time ./hg log -qr "first(branch(default))"
0:3a6a38229d41

real  0m0.300s
user  0m0.198s
sys 0m0.069s
2014-01-28 16:19:30 -08:00
Lucas Moscovicz
7a6ce89407 revset: added lazyset implementation to branch revset
Performance Benchmarking:

$ time hg log -l1 -qr "branch(default)"
0:3a6a38229d41

real  0m3.366s
user  0m3.217s
sys 0m0.095s

$ time ./hg log -l1 -qr "branch(default)"
0:3a6a38229d41

real  0m0.389s
user  0m0.199s
sys 0m0.061s
2014-02-05 16:12:03 -08:00
Lucas Moscovicz
0ff716dae6 revset: changed getset so that it can return a lazyset
Not converting it manually to a baseset anymore. At this point every revset
method should return a baseset typed structure.
2014-01-28 15:19:14 -08:00
Lucas Moscovicz
fb15b99ea8 revset: added operations to duck type baseset
Added more operations which are not lazy but only used so far to duck type
baseset.

Their implementations will be changed in future patches.
2014-02-06 14:29:37 -08:00
Lucas Moscovicz
dd14a88eaa revset: added basic operations to lazyset
Added methods __add__, __sub__ and __and__ to duck type more methods in
baseset
2014-02-06 14:25:37 -08:00
Lucas Moscovicz
939eba25eb revset: added lazyset class with basic operations
This class allows us to return values from large revsets as soon as they are
computed instead of having to wait for the entire revset to be calculated.
2014-02-06 14:19:40 -08:00
Lucas Moscovicz
5ea4d9b527 revset: minor changes adding baseset to revsets
Changed bits of code to work with baseset implementations.
2014-02-06 14:57:25 -08:00
Lucas Moscovicz
c5d089f8a5 revset: minor changes adding baseset to revsets
Changed bits of code to work with baseset implementations.
2014-02-06 14:57:25 -08:00
Lucas Moscovicz
91dcdf4e40 revset: added __add__ method to baseset class 2014-02-06 11:37:16 -08:00
Lucas Moscovicz
03857b594a revset: added docstring to baseset class 2014-02-06 11:33:36 -08:00
Lucas Moscovicz
0c945a320b revset: fixed bug where revset returning order was being changed
Some revsets were innecesarily turning the subset into a set before iterating
over it. This led to returning order changing in some cases.
2014-02-07 15:01:33 -08:00
Lucas Moscovicz
3d0344901f revset: added intersection to baseset class
Added the method __and__ to the baseset class to be able to intersect with
other objects in a more efficient way.
2014-01-24 16:57:44 -08:00
Lucas Moscovicz
f1e6aec1ef revset: added substraction to baseset class
Added __sub__ method to the baseset class to be able to compare it with other
subsets more efficiently.
2014-01-23 14:20:58 -08:00
Lucas Moscovicz
e0e3b9efa2 revset: implemented set caching for revset evaluation
Added set caching to the baseset class. It lazily builds the set whenever it's
needed and keeps a reference which is returned when the set is requested
instead of being built again.
2014-01-22 10:46:02 -08:00
Lucas Moscovicz
ef8bd69f5f revset: added baseset class (still empty) to improve revset performance
This class is going to be used to cache the set that is created from this list
in many cases while evaluating a revset.
2014-01-21 11:39:26 -08:00
FUJIWARA Katsunori
9baf47cf1a revset: add explanation about the pattern without explicit kind
Before this patch, online help of "adds()", "contains()", "filelog()",
"file()", "modifies()" and "removes()" predicates doesn't explain
about how the pattern without explicit kind like "glob:" is treated,
even though each predicates treat it differently:

  - as "relpath:" by "adds()", "modifies()" and "removes()"

  - as "glob:" by "file()"

  - as special by "contains()" and "filelog()"
    - be relative to cwd, and
    - match against a file exactly
      ("relpath:" matches also against a directory)

This may confuse users.

This patch adds explanation about the pattern without explicit kind
to these predicates.
2014-01-17 23:55:11 +09:00
FUJIWARA Katsunori
92ff577d38 revset: use "canonpath()" for "filelog()" pattern without explicit kind
Before this patch, revset predicate "filelog()" uses "match.files()"
to get filename also for the pattern without explicit kind.

But in such case, only canonicalization of relative path is required,
and other initializations of "match" object including regexp
compilation are meaningless.

This patch uses "pathutil.canonpath()" directly for "filelog()"
pattern without explicit kind like "glob:", for efficiency.

This patch also does below as a part of introducing "canonpath()":

  - move location of "matchmod.match()" invocation, because "m" is no
    more used in "if not matchmod.patkind(pat)" code path

  - omit passing "default" argument to "matchmod.match()", because
    "pat" should have explicit kind of pattern in this code path
2014-01-17 23:55:03 +09:00
FUJIWARA Katsunori
4d5d9b1517 revset: avoid loop for "match.files()" having always one element for efficiency
This patch avoids the loop for "match.files()" having always one
element in revset predicate "filelog()" for efficiency: "match" object
"m" is constructed with "[pat]" as "patterns" argument.
2014-01-17 23:42:12 +09:00
FUJIWARA Katsunori
7e4fbdb87b revset: make default kind of pattern for "contains()" rooted at cwd
Before this patch, default kind of pattern for revset predicate
"contains()" is treated as the exact file path rooted at the root of
the repository. This decreases usability, because:

  - all other predicates taking pattern argument (also "filelog()")
    treat such pattern as the path rooted at the current working
    directory

  - "contains()" doesn't describe this difference in its help

  - this difference may confuse users

    for example, this prevents revset aliases from sharing same
    argument between "contains()" and other predicates


This patch makes default kind of pattern for revset predicate
"contains()" be rooted at the current working directory.

This patch uses "pathutil.canonpath()" instead of creating "match"
object for efficiency.
2014-01-17 23:42:12 +09:00