[Python-Dev] False alarm: big performance hit in the past few days

Skip Montanaro skip@pobox.com
Wed, 3 Apr 2002 23:26:01 -0600


I found the problem.  You'll be glad to know it wasn't with the Python
code.  It turned out to be compiler flags.  When I was benchmarking on March
31, I was specifically setting OPT to something like

    -O3 -DSMALL_REQUEST_THRESHOLD=256

Today, I left SMALL_REQUEST_THRESHOLD alone.  Since the default optimization
level is -O3, I wasn't specifying OPT at all.  The default is "-g -O3".

With specific setting of OPT to just -O3, I get these performance numbers:

    cvs up -D 2002-03-31 12:00

    This machine benchmarks at 5652.91 pystones/second
    Pystone(1.1) time for 100000 passes = 17.81
    This machine benchmarks at 5614.82 pystones/second
    Pystone(1.1) time for 100000 passes = 17.88
    This machine benchmarks at 5592.84 pystones/second
    278.18user 0.39system 5:11.91elapsed 89%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (400major+3942minor)pagefaults 0swaps

    cvs up -A

    Pystone(1.1) time for 100000 passes = 17.8
    This machine benchmarks at 5617.98 pystones/second
    Pystone(1.1) time for 100000 passes = 18.04
    This machine benchmarks at 5543.24 pystones/second
    Pystone(1.1) time for 100000 passes = 17.85
    This machine benchmarks at 5602.24 pystones/second
    278.95user 0.26system 4:51.27elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (404major+3941minor)pagefaults 0swaps

so it appears nothing has changed performance-wise since the 31st.

Apparently, addition of debugging symbols exacts a pretty significant toll
on performance now.  I don't recall that being the case in the past.
Perhaps this feature is something new with gcc3.  Makes me think perhaps -g
should be deleted from the default OPT setting.  I'm pretty sure one of the
reasons Stallman used to give for always including -g in compiles in the old
days (when the only GNU programs were, practically speaking, gcc, gdb and
emacs) was that you got debugging capability without taking a performance
hit.

Skip