hgext/progress.py
author Durham Goode <durham@fb.com>
Sun, 20 Sep 2015 19:27:53 -0700
changeset 26305 ade5c488d622
parent 26073 5ef327e9c157
permissions -rw-r--r--
revset: remove existence check from min() and max() min() and max() would first do an existence check. Unfortunately existence checks can be slow in certain situations (like if the smartset is a list, and quickly iterable in both ascending and descending directions, then doing an existence check will start from the bottom, even if you want to check the max()). The fix is to not do the check, and just handle the error if it happens. In a large repo, this speeds up: hg log -r 'max(parents(. + .^) - (. + .^) & ::master)' from 3.5s to 0.85s. That revset is contrived and just for testing. In our real case we used 'bundle()' in place of '. + .^' Interesting perf numbers for the revset benchmarks: max(draft() and ::tip) => 0.027s to 0.0005s max(author(lmoscovicz)) => 2.48s to 0.57s min doesn't show any perf changes, but changing it as well will prevent a perf regression in my next patch. Result from revset benchmark revset #0: draft() and ::tip min max 0) 0.001971 0.001991 1) 0.001965 0.000428 21% revset #1: ::tip and draft() min max 0) 0.002017 0.001912 1) 0.001896 94% 0.000421 22% revset #2: author(lmoscovicz) min max 0) 1.049033 1.358913 1) 1.042508 0.319824 23% revset #3: author(lmoscovicz) or author(mpm) min max 0) 1.042512 1.367432 1) 1.019750 0.327750 23% revset #4: author(mpm) or author(lmoscovicz) min max 0) 1.050135 0.324924 1) 1.070698 0.319913 revset #5: roots((tip~100::) - (tip~100::tip)) min max 0) 0.000671 0.001018 1) 0.000605 90% 0.000946 92% revset #6: roots((0::) - (0::tip)) min max 0) 0.149714 0.152369 1) 0.098677 65% 0.100374 65% revset #7: (20000::) - (20000) min max 0) 0.051019 0.042747 1) 0.035586 69% 0.016267 38%
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10434
ad104a786d35 Progress bar extension
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     1
# progress.py show progress bars for some actions
ad104a786d35 Progress bar extension
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     2
#
ad104a786d35 Progress bar extension
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     3
# Copyright (C) 2010 Augie Fackler <durin42@gmail.com>
ad104a786d35 Progress bar extension
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     4
#
15772
83a140752239 progress: Use the same GPL boilerplate as most hg files
Augie Fackler <durin42@gmail.com>
parents: 15662
diff changeset
     5
# This software may be used and distributed according to the terms of the
83a140752239 progress: Use the same GPL boilerplate as most hg files
Augie Fackler <durin42@gmail.com>
parents: 15662
diff changeset
     6
# GNU General Public License version 2 or any later version.
10434
ad104a786d35 Progress bar extension
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     7
25522
15c2c580b2a7 progress: deprecate the progress extension
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25521
diff changeset
     8
"""show progress bars for some actions (DEPRECATED)
10434
ad104a786d35 Progress bar extension
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
     9
25522
15c2c580b2a7 progress: deprecate the progress extension
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25521
diff changeset
    10
This extension has been merged into core, you can remove it from your config.
15c2c580b2a7 progress: deprecate the progress extension
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25521
diff changeset
    11
See hg help config.progress for configuration options.
10434
ad104a786d35 Progress bar extension
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
    12
"""
26073
5ef327e9c157 progress: restore testedwith to the stub
Augie Fackler <augie@google.com>
parents: 25522
diff changeset
    13
# Note for extension authors: ONLY specify testedwith = 'internal' for
5ef327e9c157 progress: restore testedwith to the stub
Augie Fackler <augie@google.com>
parents: 25522
diff changeset
    14
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
5ef327e9c157 progress: restore testedwith to the stub
Augie Fackler <augie@google.com>
parents: 25522
diff changeset
    15
# be specifying the version(s) of Mercurial they are tested with, or
5ef327e9c157 progress: restore testedwith to the stub
Augie Fackler <augie@google.com>
parents: 25522
diff changeset
    16
# leave the attribute unspecified.
5ef327e9c157 progress: restore testedwith to the stub
Augie Fackler <augie@google.com>
parents: 25522
diff changeset
    17
testedwith = 'internal'