3 ms·
It's hard to tell from these posts under what circumstances will SIMD vectorization kick in outside of numpy. E.g., will it work for plain old list comprehensio
by canjobear 11y ago
It's hard to tell from these posts under what circumstances will SIMD vectorization kick in outside of numpy. E.g., will it work for plain old list comprehensions, which are everywhere in my code? That would be awesome.
- fijal 11y agoGenerally speaking "no", but there are a few cases where it might, e.g. if you're using arrays/numpy arrays in list comprehensions. We could not get it to run on normal lists for a bit obscure reasons.
- Beltiras 11y agoI did a small test, here's the gist:https://gist.github.com/arnists/a9f19af5d9469549020e https://gist.github.com/arnists/a9f19af5d9469549020e Seems like a huge improvement, don't know if it's the recent additions or in general pypy vs cpython but it's enough of a speed bump to sit up and take note.
- lqdc13 11y agoThat's why you don't use pure python for this. Here is your test done using numpy import numpy as np %timeit sum(np.sum(np.random.randint(0, 10000000, 5000)) for i in range(5000)) 1 loops, best of 3: 586 ms per loop
- Beltiras 11y agoI was mostly getting a comparison between cpython and pypy, less concerned with numpy vs cpython.
- lqdc13 11y agoSure, but my point is that it's not a relevant comparison. A relevant comparison is counting words or something like that. Things people don't have an easy way to do much faster.