4 ms·
Processing 1GB in 250ms seems rather slow for such a simple problem. That's about 0.5-1 CPU cycles per byte. I would have expected well written SSE code to be s
by CodesInChaos 9y ago
Processing 1GB in 250ms seems rather slow for such a simple problem. That's about 0.5-1 CPU cycles per byte. I would have expected well written SSE code to be several times faster than that.
Something like accumulating to three separate SSE registers per iteration and then combining them outside the loop.
- deleted 9y ago[deleted]
- holycrapwhodat 9y agoMaybe if you read the entire file into RAM first and then timed just the processing of the bytes. But I'd wager it's probably limited by the SSD speed and filesystem caching code at this point. (Would be easy enough for an assembly guru to prove either of us right or wrong!)
- function_seven 9y agoThe 250ms figure does not include loading the file into RAM. It's just memory access and number crunching.
- tpolzer 9y agoOn my system the naive approach + mmap + gcc-7.2 (-O3 -march=native) gets 0.126s if the file is in cache, so 8GB/s. The same code on memory instead of a file gives me around 14GB/s. Maximum I can achieve with threads and/or intrinsics is 18GB/s (theoretical maximum for my dual channel memory is 20GB/s). This is pretty much a memory bounded problem. I assume the author was using an older gcc version (as mentioned, autovectorization is not really a solved problem), and a lot of time in this scenario is going into file I/O: real 0m0.126s user 0m0.071s sys 0m0.056s