Continuing from the previous Adventures with string_view post, in this new article I show how you can achieve massive performance gains using code characterized by O(1) constant-time asymptotic complexity.
by Giovanni Dicanio
From the article:
While this code works fine, it’s possible to optimize it.
As the saying goes, first make things work, then make things fast.
Replacing a O(N) operation with a O(1) operation in this case gives a performance boost of 88 ms vs. 445 ms, which is an 80% performance gain!