[Python-3000] Droping find/rfind?

Neal Norwitz nnorwitz at gmail.com
Thu Aug 24 16:25:04 CEST 2006


On 8/24/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
>
> (which reminds me that speeding up handling of optional arguments to C functions
> would be an even better use of this energy)

If this patch:  http://python.org/sf/1107887 is integrated with some
of my current work, it should do the job nicely.  IIRC the patch uses
a big switch which sped things up, but Raymond didn't like it (I think
more on a conceptual basis).  I don't think it slowed things down
measurably.

My new approach has been to add a C function pointer to PyCFunction
and some other 'function' objects that can dispatch to an appropriate
function in ceval.c that does the right thing.  I define a bunch of
little methods that are determined when the function is created and
only does what's necessary depending on the ml_flags.  It could be
expanded to look at other things.  The current work hasn't produced
any measurable changes in perf, but I've only gotten rid of a few
comparisons and/or a possible function call (if it isn't inlined).  If
I merge these two approaches, I should be able to be able to speed up
cases like you describe.

n


More information about the Python-3000 mailing list