A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-January/019370.html below:

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

[Python-Dev] eval() slowdown in 2.2 on MacOS X? [Python-Dev] eval() slowdown in 2.2 on MacOS X?Skip Montanaro skip@pobox.com
Thu, 10 Jan 2002 15:12:31 -0600
    >> 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



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4