Author skrah
Recipients larry, serhiy.storchaka, skrah
Date 2020-07-18.09:04:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595063047.75.0.840088102926.issue41262@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-07-18 09:04:07skrahsetrecipients: + skrah, larry, serhiy.storchaka
2020-07-18 09:04:07skrahsetmessageid: <1595063047.75.0.840088102926.issue41262@roundup.psfhosted.org>
2020-07-18 09:04:07skrahlinkissue41262 messages
2020-07-18 09:04:07skrahcreate