4 ms·
17 cycles still seems pretty slow compared to the methods explored in this article, which got the result down to 0.75ns (~3 cycles?) (for integer strings of a k
by nly 3y ago
17 cycles still seems pretty slow compared to the methods explored in this article, which got the result down to 0.75ns (~3 cycles?) (for integer strings of a known length):
https://kholdstare.github.io/technical/2020/05/26/faster-integer-parsing.html https://kholdstare.github.io/technical/2020/05/26/faster-int...
Most of the overhead is found in dealing with variable length input, minus signs, and overflow checking.
- kolbe 3y agoI'm guessing the instruction pipeline gets packed, so 4-5x more than 3 cyles.
- nly 3y agoIf all you care about is throughput, that's what you want
- foota 3y agoAlso, the benchmark of exactly as written there is missing some overhead, as it will always be cached. Memory accesses aren't likely to be an issue here, but I always try to run over a couple dozen or hundred of megs of input in benchmarks to ward against that.
- foota 3y agoI think the technique there is largely covered within the op, but it seems like this may be a somewhat well known technique.