Cython taking more time than regular Python
Stefan Behnel
stefan_ml at behnel.de
Tue Sep 20 01:27:34 EDT 2016
More information about the Python-list mailing list
Tue Sep 20 01:27:34 EDT 2016
- Previous message (by thread): Cython taking more time than regular Python
- Next message (by thread): Cython taking more time than regular Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Peter Otten schrieb am 19.09.2016 um 14:55: > In [7]: %%cython > def omega(int n): > cdef long i > cdef long result = 0 > for i in range(n): result += i > return result > ...: > > In [8]: %timeit omega(100000) > 10000 loops, best of 3: 91.6 µs per loop Note that this is the worst benchmark ever. Any non-dump C compiler will happily apply Young Gauß and calculate the result in constant time. Stefan
- Previous message (by thread): Cython taking more time than regular Python
- Next message (by thread): Cython taking more time than regular Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list