Broken. This will generate page faults if your string ends at a page-boundry and start address isn't aligned on four bytes.
92 karma · joined March 19, 2012
For some info: https://www.youtube.com/watch?v=CGZRHJvJYIg
Why Vector Clocks are Easy
Why Vector Clocks Are Hard
Why Logical Clocks Are Easy
Waterproof test: https://vimeo.com/39962259
Also you need to calculate size from the byte in the word that is zero, not the word itself.
And IIRC repe cmpsb isn't bad for longer strings on new x86. It's the initial setup that adds overhead. Still, you want to make a fast general solution.
If you like mallocs: https://github.com/emeryberger/Malloc-Implementations. Don't think they have the disruptor based one yet: https://github.com/bytemaster/disruptor/tree/master/fc2
But I think the new connection pool in Tomcat might be interesting as well.