After implementing some vector algebra based on generic algorithms and iterators, I decided to run some benchmarks. The idea was to compare custom vectors' with meta.Vector
s' performance (doing addition and scaling).
When vectors' size was set to 10, custom vectors slightly outperformed meta.Vector
s. When vectors' size was set to 100, meta.Vector
s slightly outperformed custom vectors. When vectors' size was set to 1000, custom vectors performed addition twice as slowly as meta.Vector
s and scaling -- slightly more slowly than meta.Vector
s (using @splat
).
Funniest thing is compilation times -- those grew with vectors' size growth (didn't measure, can't tell if compilation time was linear in vectors' size). When vectors' size was set to 10_000, I eventually (after a long wait) received shell returned 137
error message (during compilation); after I've commented out any mention of meta.Vector
, code compiled just fine.
So my question is what kind of (compiler?) dark magic makes 1000-sized meta.Vector
s work so fast and can I use it to make my code faster?
P. S.: benchmarks were run with -O ReleaseFast, all variables were marked var
P. P. S.: in debug mode code with 10_000-sized meta.Vector
s eventually compiled
AFAIK all it does is explicitly leverage LLVM's SIMD support.