Python Performance
Markus Kohler
markusk at bidra241.bbn.hp.com
Mon Jul 26 05:32:56 EDT 1999
Markus Stenberg <mstenber at cc.Helsinki.FI> writes:
> gward at cnri.reston.va.us (Greg Ward) writes:
> > sreekant kodela <sreekantk at freenet.co.uk> wrote:
> > If you're concerned about runtime performance -- ie. how long it takes
> > to mangle strings and loop over lists and so forth -- I wouldn't worry
> > about it. Yes, Python is slow, but the Internet is so much slower that
> > it hardly matters.
>
> Even in websites' case, I would worry; Python doesn't use multiCPU very
> well, and with single CPU, it is fairly easy to saturate one with
> pure-Python code, especially if it is badly designed to boot.
>
> For AMD K6-2 300mhz, your mileage may vary:
>
> Normal null method call : 156332.1874/sec [0.19s] (6.3966us/call)
> (=simple, def foo(): pass call)
> Apply null method call : 39783.6246/sec [0.75s] (25.136us/call)
> (=simple, foo-call using apply)
Yes that is much too slow. Good OO style requires a lot of function calls.
I'm sure Visualworks a commercial Smalltalk implementation can do millions
of calls on this machine. Ok it's a JIT and it's commercial but's still Smalltalk
and therefore at least as dynamic as python. I guess even Squeak (www.squeak.org)
would be faster. If you would sent us code, I could prove it.
[more interesting numbers deleted]
> - Speed-does-matter-ly yours, Markus
Yes Speed does matter even for scripting languages.
IMHO the whole advantage of scripting languages is that they
are more productive than other compiled languages like C.
The faster a scripting languages is the less you need to do in lower
level languages. Therefore making the scripting language faster should
increase productivity.
>
> P.S. This might surface as one example for 'why scripting languages don't
> always cut it' in my master's thesis; if I have made some grievous
> error(s?), corrections are welcome.
>
> P.P.S. Too bad Python doesn't have anything that creates _nice_ code, like
> Stalin for Lisp ;-)
Yes Stalin is great but it's a static compiler. That limits it's appliacations and
also really works if the generated code does exactly the same as the interpreted
code. A profiling JIT like Sun's Hotspot compiler for Java, might be a better choice. .
>
> --
> ----- BEGIN GEEK CODE v3.0 BLOCK (*) -----
> GCS d- s+: !a C+(++) UL+++$ P--- L+++ E++ W-- N+ W--- O---- M-- V- PS+++
> Y+ PGP++>+++ t+@ 5++ X+ R* tv-- b+++ DI+++>++++ D---- G++ e++ h* r% z+
> ----- END GEEK CODE v3.0 BLOCK -----
> * For spoilers, check http://www.geekcode.com
--
Markus Kohler mailto:markus_kohler at hp.com
More information about the Python-list
mailing list