Python IS slow ! [was] Re: Python too slow for real world

Christian Tismer tismer at appliedbiometrics.com
Sun May 2 10:54:05 EDT 1999


Just a word about LOAD_FAST and LOAD_CONST.

I looked into the macro expansions in ceval.c, and the real
difference is just that LOAD_FAST has a shortcut in the
interpreter loop which reads

			if (x != NULL) continue;

LOAD_CONST doesn't have this. I did a quick test to see
the difference, and afterwards, LOAD_CONST was in fact
slightly faster than LOAD_FAST.
But...

result = """
>>> test()
func1 (6.32, 42)  # LOAD_FAST
func2 (7.36, 42)  # LOAD_GLOBAL
func2 (6.21, 42)  # should read func3, does LOAD_CONST
>>> 
# with patch to ceval.c
>>> test()
func1 (7.08, 42)
func2 (7.8, 42)
func2 (6.76, 42)
>>> 
"""

... due to the platform specific optimization strategy
of the compiler, an overall speed loss was the effect.
Makes no sense to supply a patch. Instead I would claim
that both opcodes are virtually at the same speed and
one should not worry about it.

ciao - chris   (back to real work:)

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home




More information about the Python-list mailing list