Re:Optimizing the Particle Life: From 400 to 4M particles
by GeompMankle on Monday March 18, 2024 @03:36PM
(#39748971)
Negative again, a series of array operations which are individually idiomatic numpy like this will run very very fast in numba as it can coalesce the ops into a single pass through memory. Numpy can't do this and has to pass through the array for each individually array operation. There's nothing wrong with straight numpy but if you want it compiled-C fast for the whole ensemble of array ops, you need a JIT.
[ Parent
| on HN ]
Re:Optimizing the Particle Life: From 400 to 4M particles
by cl3misch on Monday March 18, 2024 @03:50PM
(#39749122)
Ah, I was under the impression that using array OPs inside a numba njit gave worse performance. Has this changed, or is my memory tricking me?
Do you have a source for this? I have not seen it in the numba docs.
Re:Optimizing the Particle Life: From 400 to 4M particles
by physicsguy on Monday March 18, 2024 @06:04PM
(#39750615)
Numba replaces ops with LLVM byte code equivalent so the compiler will optimise out and coalesce the operations as part of the optimisation stage.
If you want to look at the sort of things compilers do though, take a look at “common subexpression elimination”