From:
"Skip Montanaro" <skip@pobox.com>
Replying To:
Andrew Kuchling <akuchlin@mems-exchange.org>
Date:
Thu, 10 Jan 2002 15:12:31 -0600
Subject:
Re: [Python-Dev] eval() slowdown in 2.2 on MacOS X?
>> BTW, I forgot to pass this on yesterday, but I tried the code in Tim
>> Peters' e-mail yesterday and the delay happens during the code =
>> compile(...) statement.
I saw the same effect on my Linux laptop (with a mere 128MB). The disk went
nuts when it tried compiling
"[" + "2," * 200000 + "]"
VM size as reported by top went to 98.5MB. This does not appear to be
exclusively a 2.2 issue, as I got this with the fresh 2.1.2 I built this
morning.
If you consider what this compiles to:
LOAD_CONST 1 (2)
LOAD_CONST 1 (2)
LOAD_CONST 1 (2)
LOAD_CONST 1 (2)
...
LOAD_CONST 1 (2)
LOAD_CONST 1 (2)
LOAD_CONST 1 (2)
LOAD_CONST 1 (2)
BUILD_LIST 200000
To generate that it has to generate and parse a pretty deep abstract syntax
tree. It looks like symtable_node gets called once for each list element.
There are probably other functions that are called once per list element as
well.
Skip
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev