[Python-Dev] [ANN] VPython 0.1

M.-A. Lemburg mal at egenix.com
Thu Oct 23 12:02:12 CEST 2008


On 2008-10-23 09:08, J. Sievers wrote:
> a) It's fairly easy to implement different types of dispatch, simply by
> changing a few macros (and while I haven't done this, it shouldn't be a
> problem to add some switch dispatch #ifdefs for non-GCC platforms).
> 
> In particular, direct threaded code leads to less horrible branch
> prediction than switch dispatch on many machines (exactly how
> pronounced this effect is depends heavily on the specific
> architecture).

Since VPython is GCC-only, how about naming the patch PyGCCVM ?!

I doubt that you'll find the same kind of performance increase
when using switch-based dispatching, but using more profile based
optimizations, it should be possible to come up with a solution
that provides a few 10% performance increase while still remaining
portable and readable.

When working on the switch statement in ceval some 10 years ago
it was easy to get a 10-20% performance increase by just moving
the switch cases around, breaking the switch in two groups of
opcodes that are used a lot and one for less often used ones and
then introducing a few fast paths via goto.

However, at that time CPUs had much smaller internal caches and
the 1.5.2 ceval VM had obviously hit some cache size limit on
my machine, since breaking the switch in two provided the best
performance increase. With todays CPUs, this shouldn't be a
problem anymore.

BTW: I hope you did not use pybench to get profiles of the opcodes.
That would most certainly result in good results for pybench, but
less good ones for general applications such as Django or Zope/Plone.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Oct 23 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611


More information about the Python-Dev mailing list