[Python-Dev] Mercurial sluggishness (was: this is what happens if you freeze all the modules required for startup)
Stephen J. Turnbull
stephen at xemacs.org
Tue Apr 15 18:59:59 CEST 2014
Skip Montanaro writes:
> "Instant" for me is "the blink of an eye," which Wikipedia reports as
> typically between 100ms and 400ms.
> <http://en.wikipedia.org/wiki/Blink> If you blink, you've missed
> Python 2.7 startup on a relatively modern machine.
This is what I see for Mac OS X "Mavericks" on a 2.7GHz Core i7:
# Apple's /usr/bin/python, Python 2.7.5, built with clang 5.0.0
$ time python -c "" # cold warm warm
real 0.967s 0.020s 0.022s
user 0.025s 0.011s 0.012s
sys 0.061s 0.009s 0.007s
# MacPorts /opt/local/bin/python3.3, Python 3.3.5, same compiler
$ time python3.3 -c ""
real 1.034s 0.041s 0.037s
user 0.065s 0.030s 0.028s
sys 0.036s 0.008s 0.007s
Further iterations of warm cache starts remain (coincidentally, I
would guess, but it's indicative) in the ranges above. I don't feel
like rebooting or otherwise figuring out how to evict python from the
cache to get a sense of variation for cold cache startup, but
obviously it's more than an order of magnitude slower than warm start
for both Pythons.
Warm start numbers are well within Daniel's "50ms" spec. Granted user
time for Python 3.3 is 2.5-3X that of Python 2.7 warm or cold, it's
still below human JND (if you can see it, it's probably a slow display
;-). So it's all about waiting on the OS, it seems to me.
By comparison, git:
$ time git --version # cold warm warm
real 0.430s 0.017s 0.021s
user 0.007s 0.006s 0.006s
sys 0.009s 0.006s 0.006s
OK, Python 2.7 is slower than git and Python 3.3 much slower. But I
don't think this explains anybody's feeling that hg is sluggish
compared to git -- git also shows perceptible delay on a cold start, I
didn't notice it being faster (I wasn't thinking about it, though, and
I wasn't in a hurry to see the version string). I suspect Linus has
spiked everybody's Kool-Aid and it's a mass hallucination. More
seriously, I wouldn't be surprised if git is just better optimized for
certain operations that people expect to be fast.
More information about the Python-Dev
mailing list