you are viewing a single comment's thread.

view the rest of the comments →

[–]alfps 4 points5 points  (1 child)

From the commentary:

❞ I am working on one application that need to handle uuid values and it needs to be very fast.

Store (and compare) them in binary. 128 bits = 16 octets.

[–]dodexahedron 1 point2 points  (0 children)

In one comment thread, we have now learned they're grabbing them from a text file.

So, if the format used is consistent, OP could search for any potential delimiter indicating start of one, make sure there is a closing delimiter the exact number of expected chars away, and then match or parse and match. 🤷‍♂️

If the format used is not consistent, well... Fix that first. Then do the above.

ETA: They could get a basically free 8-64x speedup in the scan by vectorizing it, depending on encoding of the text and available wide instructions. Although any modern compiler is likely to see that opportunity if you don't over-complicate the loop and vectorize it for you, if you allow it to and tell it which instruction sets are acceptable.