Stefan Krah <ste...@bytereef.org> added the comment:
I cannot detect a speedup in test_buffer, which is a heavy user of memoryviews: # before: >>> a = [3.742, 3.589, 3.542, 3.495, 3.481, 3.620, 3.773, 3.755, 3.701, 3.661] >>> sum(a) / 10 3.6358999999999995 # after >>> b = [3.63, 3.596, 3.475, 3.43, 3.792, 3.58, 3.810, 3.52, 3.55, 3.690] >>> sum(b) / 10 3.6072999999999995 A microbenchmark shows a speedup: # before: $ ./python -m timeit -s "b = b'1234567890'" "memoryview(b)" 2000000 loops, best of 5: 116 nsec per loop # after: ./python -m timeit -s "b = b'1234567890'" "memoryview(b)" 5000000 loops, best of 5: 98 nsec per loop As the original author, I'm not sure why I should put up with the less readable code for such a gain. For decimal I'm using the pi benchmark, which, while small, is at least a real math function in pure Python. Do you have other benchmarks? ---------- status: closed -> open _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41262> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com