Re: Is Python terribly slow ?

Guido.van.Rossum@cwi.nl
Wed, 02 Feb 1994 18:36:27 +0100

I've run a small test program on similar input and I believe that most
(i.e. more than 95%) of your processing time disappears in atoi() and
atof().

These are currently implemented very inefficiently, in Python: first a
loop over the string checks that the string has the proper format,
then eval() is called to parse and evaluate the number. I've done a
small check replacing the atoi() and atof() calls directly with eval()
and it reduces the time by half. eval() is still very inefficient; I
presume that with an atoi and atof coded in C, most overhead should
disappear. If these two functions are added to the built-in module
strop (string operations) then it will speed up most programs
retrospectively. Any volunteers to code it?

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>