3 ms·
To me, the takeaway is that there is a ~10x performance difference between the near-worst case memory access pattern (330 cycles) compared to the best using SIM
by lscharen 8y ago
To me, the takeaway is that there is a ~10x performance difference between the near-worst case memory access pattern (330 cycles) compared to the best using SIMD (41 cycles).
A potential order of magnitude improvement hiding in the memory access patterns of your code makes this worthwhile information for a lot of devs.
- corysama 8y agoAdditionally, if you do the wait for a byte, you've done 90% of the wait for 63 adjacent bytes. Software becomes memory bound when it peeks at 4 bytes here, 4 bytes there in zillions of unpredictable cache lines. So, instead of waiting 41 cycles to process 64 bytes, it waits 300 cycles to process 4. It helps to think of the * and -> operators in C++ as "int cache64BytesAndLoad4FromCache(int *p);" That's when you start to really feel "int x = a->b->c->d; a = a->next;" deep in your gut.