The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

BartC bc at freeuk.com
Wed Mar 23 09:41:46 EDT 2016


On 23/03/2016 10:48, Chris Angelico wrote:
> On Wed, Mar 23, 2016 at 9:34 PM, BartC <bc at freeuk.com> wrote:

>> Someone could be interested in cars, mechanics and performance without
>> wanting to know the most Pythonic way to get from Kings Cross to Heathrow.
>
> But if I complain that the trek across four blocks of London cost me
> ninety minutes and my train ticket (which I then had to get replaced),
> you would blame it on me getting lost, rather than accepting my
> assertion that London's slow to get around. And if you said "hey, take
> a bus or a taxi next time", and I next time walked and got lost again,
> you would rightly call me a fool. And if I then had the audacity to
> say that London's streets are badly designed, because I looked at them
> and even without knowing what sort of traffic goes on them, I can tell
> that those are slow roads... you'd have very little respect for my
> statements about London. It wouldn't matter if I'm the world's
> greatest expert on hiking from Adelaide to Perth; it wouldn't matter
> how many nuances of Nullarbor sand I'm familiar with, nor how best to
> find drinking water there. I clearly know nothing about London, and my
> complaints about the city should be taken with a grain of salt, until
> such time as I put in the effort to get to know YOUR city YOUR way.

To extend this analogy better, executing byte-code to directly perform a 
task itself might be equivalent to travelling on foot, while everyone is 
suggesting taking the bus, tube or taxi.

But when you are on foot, it might be worth looking at what's slowing 
you down, or indeed at whether you are actually being slowed down at 
all. With walking it's easy because 3mph is typical, you'll know when 
something is obviously wrong (dragging or carrying a huge amount of 
baggage with you for example). Running byte-code is not so obvious.

Interestingly, the typical difference between my byte-code and 
CPython's, is roughly the same as between (my) cycling and walking. With 
odd spots where CPython is quicker (which I'm investigating...).

While PyPy can sometimes beat both of those, on a straight downhill 
section, but I suspect it cheats there a little by being motor-assisted.

(FWIW, in central London usually I walk or cycle. I wouldn't walk from 
King's Cross to LHR, nearly 20 miles, unless I had nothing better to do, 
or there was no alternative.)

-- 
Bartc



More information about the Python-list mailing list