Mac vs. Linux for Python Development

Chris Angelico rosuav at gmail.com
Sun Mar 2 04:58:52 EST 2014


On Sun, Mar 2, 2014 at 6:35 PM, Frank Millman <frank at chagford.com> wrote:
> I assume by 'warm cache' you mean that I had used the decimal module before
> and not switched the machine off before trying the above exercise.
>
> In my case, the machine was switched off before I started. I switched it on
> and executed the above steps.

That would be about it, yeah. So that would be a cold cache test.

> To be slightly more precise, instead of 'the blink of an eye', I estimate it
> was between 250-500 ms. If I close the interpreter and start it up again, it
> takes maybe 100-200ms.

Alright, so now we're talking about some other factors on my system
that slow down the cold cache load dramatically. That I can completely
understand; when I originally posted it, I was fully aware that the
exact figures wouldn't be duplicable. 500ms is a major delay to
startup; but what's really significant is the 100-200ms warm cache,
because that one is what's going to be repeated. (Imagine a web server
that periodically restarts its subprocesses - say, every N requests.
Adding 200ms to startup time effectively adds 200/N ms to every
request.)

An awesome disk cache can improve that immensely, though. My Debian
box, warm cache, takes 0.0 seconds to import decimal. But it's a
faster computer overall, so even cold cache it only takes a hundred ms
or so.

> Just to be sure, I switched the machine off and on again, and repeated the
> exercise. Starting the interpreter for the first time takes 1.5 - 2 seconds.
> Importing decimal for the first time takes less than 500ms.

I'm beginning to get a suspicion here that the Windows XP disk cache
actually might have a "most pessimal" state, where it's full of other
stuff. Worse than a cold cache in performance, a cache warmed by
something else. But in any case, the exact figures for cold cache are
almost immaterial compared to a noticeable warm-cache delay - if
there's enough work to be done just loading the .pyc from the disk
cache that it takes visible time, then it would be a problem to force
that to be loaded on every interpreter startup. Which was kinda the
point of my original testing - I wanted to know how much of a penalty
there'd be to moving decimal to built-in.

ChrisA



More information about the Python-list mailing list