Can Cython speed up array of object iteration?

Looks like code like this gives about 20x speedup.

Looks like code like this gives about 20x speedup: import numpy as np cimport numpy as np cdef class Base(object): cdef int fun(self): return -1 cdef class A(Base): cdef int fun(self): return 3 cdef class B(Base): cdef int fun(self): return 2 def test(): bbb = np. Array(A(), B(), B(), A(), dtype=np. Object_) cdef np.

Ndarraydtype=object, ndim=2 a = bbb cdef int i, x, y cdef int s = 0 cdef Base you for I in xrange(1000): for x in xrange(2): for y in xrange(2): you = ax,y s += u.fun() return s It even checks, that A and B are inherited from Base, probably there is way to disable it in release builds and get additional speedup EDIT: Check could be removed using you = ax,y.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions