4 ms·
How big are the spectra, and how big is the data for a full run here? I had a hard time getting a sense for that. I was expecting the story to turn and show a
by dahart 5y ago
How big are the spectra, and how big is the data for a full run here? I had a hard time getting a sense for that.
I was expecting the story to turn and show a huge ~100x coming from numpy, and surprised by the very small impact. That’s exactly what’s happened to me when I’ve switched image processing or simulations from raw python to numpy. Maybe I’m completely misunderstanding the problem, but it looks like the issue might be that numpy is not bubbled all the way up to be the outside of the main loop, maybe in this case on the outside of the entire spectrum calculation (if I’m understanding the problem at all). To see the real gains from numpy, you have to turn your program all the way inside out.
- dr_zoidberg 5y agoI got a weird feeling from the article in which the author seems to know quite a bit about numpy (citing a few parts of the source even!) but then it uses python loops all around! Just like you, I'm not really following the domain calculations, so maybe there's a reason that code can't be properly vectorized. But as others have commented, I'm a bit at a loss why the author didn't try numba or Cython.