Re:What Every Programmer Should Know About Memory (2007) [pdf]
by esmi on Monday March 04, 2019 @04:59PM
(#19306019)
I have to admit, I was skeptical but my complier did pick SIMD for the second and not the first and it did make a huge difference.
2.8G Core i7 1600MHz DDR3
[ Parent
| on HN ]
Re:What Every Programmer Should Know About Memory (2007) [pdf]
by WallWextra on Monday March 04, 2019 @05:23PM
(#19306205)
n.b. there would be a difference even without vectorization
Re:What Every Programmer Should Know About Memory (2007) [pdf]
by gdy on Tuesday March 05, 2019 @07:24AM
(#19310052)
Now you could try to time it with -fno-tree-vectorize or whatever gcc uses nowadays. You might be surprised again :)
Re:What Every Programmer Should Know About Memory (2007) [pdf]
by dragontamer on Tuesday March 05, 2019 @01:00PM
(#19312540)
Yup yup. SIMD is a CPU-level optimization, but the problem (at size 10,000 x 10,000) is DDR4 memory-limited.
SIMD only really makes a difference at the L1 or L2 cache levels. Its a fancy micro-optimization that compilers do and can improve code speed in those cases...
But the "big" change, going from column-wise traversal into row-wise traversal, is the huge memory optimization that programmers should know about. It just so happens that SIMD-optimizations are also easier for compilers to figure out on row-wise traversal, so you get SIMD-optimization "for free" in many cases.