[Cython] __next__ | not being able to use cpdef
Hoyt Koepke
hoytak at cs.ubc.ca
Tue Dec 9 01:31:00 CET 2008
> Actually, it would be interesting to see if a fast __getitem__ call
> would be available, since that would facilitate writing fast
> specialized iterators easily.
There are faster ways of doing this, but only if you know the type of
object that you're accessing with the [ ]. Cython uses optimized
versions to access lists (and tuples I think), which do speed things
up. The fastest is if it is a numpy array
(http://docs.scipy.org/doc/), where cython uses the underlying c
pointers to directly get the item, which is be orders of magnitude
faster.
--Hoyt
--
++++++++++++++++++++++++++++++++++++++++++++++++
+ Hoyt Koepke
+ University of Washington Department of Statistics
+ http://www.stat.washington.edu/~hoytak/
+ hoytak at gmail.com
++++++++++++++++++++++++++++++++++++++++++
More information about the Cython-dev
mailing list