[Python-Dev] eval() slowdown in 2.2 on MacOS X?

Andrew Kuchling akuchlin@mems-exchange.org
Mon, 07 Jan 2002 12:10:45 -0500


[CC'ed to python-dev, Barbara Mattson]

Barbara's encountered an apparent problem with test_longexp in Python
2.2 on MacOS X.  test_longexp creates a big list expression and
eval()'s it.  The problem is that it takes an exceedingly long time to
run, at least more than half an hour (at which point she interrupted
it).  

The two curious things are that 1) while test_longexp requires a lot
of memory and often thrashes on a low-memory machine (I found there
are 2 or 3 bugs in the SF bugtracker to this effect), the MacOS box in
question has a gigabyte of RAM, and 2) Python 2.1.1 *doesn't* show the
problem.  Quoting from her report:

	I tried the test_longexp by hand:

	REPS = XXX
	l = eval("[" + "2," * REPS + "]")
	print len(l)

	changing REPS from 1000 to 50000.  1000 and 10000 ran fairly
	quickly - under a minute.  However, 25000 took about 5 minutes
	and 50000 took 23 minutes.  I'm not about to try 65580 (I need
	to get some real work done today, after all :-).  BTW, out of
	curiosity, I tried the same thing under 2.1.1, and even for
	REPS = 70000 it took less than a minute.

Any clues?  

--amk                                                  (www.amk.ca)
  "Peri, how would you like to meet a genius?"
  "I thought I already have."
    -- The Doctor and Peri, in "Mark of the Rani"