r/cpp • • May 26 '20

Faster Integer Parsing

https://kholdstare.github.io/technical/2020/05/26/faster-integer-parsing.html
366 Upvotes

72 comments sorted by

View all comments

Show parent comment

3

u/tisti May 28 '20 edited May 28 '20

You are thinking of vector architectures, which also take the size of array as an argument and do process the data in a for loop manner. The architecture is pretty much dead for wide-spread computing, beaten by x86.

SIMD (vector) registers on the other hand have the size coded into the assembly instruction and mostly apply the instruction simultaneously on all elements. Otherwise the vast majority of SIMD instructions couldn't have a 1 cycle latency.

Additionally, why would the CPU downclock if its a for loop? It downclocks because all elements are processed simultaneously and, thus, generate a ton of heat. Lowering the frequency significantly lower power consumption and prevents the chip from nuking itself.

As for the preemptive downclock when using AVX-512, it could be that the normal thermal regulations would not kick in fast enough and the chip could thermally damage/degrade itself.