Lisandro Dalcin, 23.02.2010 15:04:
> On 23 February 2010 10:29, Stefan Behnel wrote:
>> Now, Python 3.x has a new PyDict_GetItemWithError() function that gives us
>> exactly what we want. So my proposal is to not duplicate any implementation
>> details from CPython (again!), but instead provide the speedup only for
>> CPython 3.x.
> 
> I agree. Cython already has many unbenchmarked (is this a word?)
> optimization that no one knows it they are worth the complexity. After
> all, if you still need a 4% speedup when looking up in a dict, just
> use Python C-API, or even implement yourself in C the
> functionality/semantics you need.

Ok, here is an implementation:

http://hg.cython.org/cython-devel/rev/8c8994167e1a

I kept the optimisation in Py2 for str, unicode and int keys, as I expect
their hash and comparison functions to be rather safe, and their use in
dicts to be extremely frequent.

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to