[Numpy-discussion] Numpy x Matlab: some synthetic benchmarks
Travis Oliphant
oliphant.travis at ieee.org
Thu Jan 19 13:31:05 EST 2006
Travis Oliphant wrote:
>
> This is what I found: overall
>
> 61242 53.9606 /usr/bin/python
> 17647 15.5488
> /usr/lib/python2.4/site-packages/numpy/core/multiarray.so
> 15942 14.0466 /lib/tls/libc-2.3.3.so
> 7158 6.3069 /no-vmlinux
> 6995 6.1633 /usr/lib/python2.4/site-packages/Numeric/_numpy.so
>
> Showing that more time is spent in NumPy than in Numeric doing
> indexing...
>
I optimized PyArray_PyIntAsIntp and changed things so that extra
allocations are not done if the indexing is not fancy in the new svn of
numpy and improved the performance of indexing a bit...
The new numbers...
samples % symbol name
551 18.4775 slice_GetIndices
482 16.1636 array_subscript
343 11.5023 parse_index
309 10.3622 PyArray_PyIntAsIntp
166 5.5667 fancy_indexing_check
164 5.4997 _IsAligned
140 4.6948 array_dealloc
134 4.4936 parse_subindex
133 4.4601 anonymous symbol from section .plt
127 4.2589 PyArray_NewFromDescr
121 4.0577 slice_coerce_index
79 2.6492 _IsFortranContiguous
67 2.2468 array_subscript_nice
56 1.8779 _IsContiguous
49 1.6432 array_alloc
31 1.0396 PyArray_UpdateFlags
29 0.9725 PyArray_Return
1 0.0335 array_itemsize_get
For reference, the Numeric numbers are:
samples % symbol name
375 25.9695 slice_GetIndices
255 17.6593 parse_index
198 13.7119 PyArray_IntegerAsInt
135 9.3490 array_subscript
130 9.0028 PyArray_FromDimsAndDataAndDescr
117 8.1025 parse_subindex
81 5.6094 slice_coerce_index
55 3.8089 array_subscript_nice
44 3.0471 array_dealloc
40 2.7701 anonymous symbol from section .plt
13 0.9003 PyArray_Return
1 0.0693 do_sliced_copy
These look a bit better and the results show that simple indexing seems
to be only slowed down by the fancy indexing check...
-Travis
More information about the NumPy-Discussion
mailing list