Re: [Cython] Speedup module-level lookup

2012-01-21 Thread Vitja Makarov
2012/1/21 Stefan Behnel : > Chris Colbert, 19.01.2012 09:18: >> If it doesn't pass PyDict_CheckExact you won't be able to use it as the >> globals to eval or exec. > > What makes you say that? I tried and it worked for me, all the way back to > Python 2.4: > > > Python 2.4.6 (#

Re: [Cython] Speedup module-level lookup

2012-01-21 Thread Vitja Makarov
2012/1/21 Stefan Behnel : > Vitja Makarov, 19.01.2012 08:49: >> 2012/1/19 Robert Bradshaw: >>> On Wed, Jan 18, 2012 at 12:30 PM, Vitja Makarov wrote: I tried to optimize module lookups (__pyx_m) by caching internal PyDict state. In this example bar() is 1.6 time faster (500us a

Re: [Cython] Speedup module-level lookup

2012-01-21 Thread Chris Colbert
On Sat, Jan 21, 2012 at 2:35 AM, Vitja Makarov wrote: > 2012/1/21 Stefan Behnel : > > Chris Colbert, 19.01.2012 09:18: > >> If it doesn't pass PyDict_CheckExact you won't be able to use it as the > >> globals to eval or exec. > > > > What makes you say that? I tried and it worked for me, all the w

Re: [Cython] Speedup module-level lookup

2012-01-21 Thread Vitja Makarov
2012/1/21 Chris Colbert : > > > On Sat, Jan 21, 2012 at 2:35 AM, Vitja Makarov > wrote: >> >> 2012/1/21 Stefan Behnel : >> > Chris Colbert, 19.01.2012 09:18: >> >> If it doesn't pass PyDict_CheckExact you won't be able to use it as the >> >> globals to eval or exec. >> > >> > What makes you say th

[Cython] AddTraceback() slows down generators

2012-01-21 Thread Stefan Behnel
Hi, I did some callgrind profiling on Cython's generators and was surprised to find that AddTraceback() represents a serious performance penalty for short running generators. I profiled a compiled Python implementation of itertools.groupby(), which yields (key, group) tuples where the group is an

Re: [Cython] AddTraceback() slows down generators

2012-01-21 Thread Dag Sverre Seljebotn
On 01/21/2012 07:50 PM, Stefan Behnel wrote: Hi, I did some callgrind profiling on Cython's generators and was surprised to find that AddTraceback() represents a serious performance penalty for short running generators. I profiled a compiled Python implementation of itertools.groupby(), which y

Re: [Cython] AddTraceback() slows down generators

2012-01-21 Thread Robert Bradshaw
On Sat, Jan 21, 2012 at 10:50 AM, Stefan Behnel wrote: > Hi, > > I did some callgrind profiling on Cython's generators and was surprised to > find that AddTraceback() represents a serious performance penalty for short > running generators. > > I profiled a compiled Python implementation of itertoo