[issue10227] Improve performance of MemoryView slicing

Stefan Krah report at bugs.python.org
Sat Feb 11 01:31:31 CET 2012


Stefan Krah <stefan-usenet at bytereef.org> added the comment:

Kristján, I ran the benchmarks from http://bugs.python.org/issue10227#msg143731
in the current cpython and pep-3118 repos. In both cases the differences between
Linux and Windows are far less pronounced than they used to be. All benchmarks
were run with the x64 builds.

I also ran the profile guided optimization build for Visual Studio. The
results are equal to (or better than) the non-pgo gcc results. In my
experience Visual Studio relies heavily on PGO for x64 builds. The
default optimizer is just not as good as gcc's.


If you can reproduce similar results, I think we can close this issue.


./python -m timeit -n 10000000 -s "x = ((b'x'*10000))" "x[:100]"

linux-cpython (4244e4348362):             0.102 usec
linux-pep-3118 (memoryview:534f6bbe5422): 0.098 usec

windows-cpython:       0.109 usec
windows-pep-3118:      0.112 usec usec
windows-pep-3118-pgo:  0.103 usec


./python -m timeit -n 10000000 -s "x = (bytearray(b'x'*10000))" "x[:100]"

linux-cpython (4244e4348362):             0.107 usec
linux-pep-3118 (memoryview:534f6bbe5422): 0.109 usec

windows-cpython:      0.127 usec
windows-pep-3118:     0.128 usec
windows-pep-3118-pgo: 0.106 usec


./python -m timeit -n 10000000 -s "x = memoryview(bytearray(b'x'*10000))" "x[:100]"

linux-cpython (4244e4348362):             0.127 usec
linux-pep-3118 (memoryview:534f6bbe5422): 0.12 usec

windows-cpython:      0.145 usec
windows-pep-3118:     0.14 usec
windows-pep-3118-pgo: 0.0984 usec

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10227>
_______________________________________


More information about the Python-bugs-list mailing list