Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
I noticed that the parsing and formatting operations of KSUIDs were quite inefficient regarding memory allocations, so I spent a bit of time optimizing them.
The biggest gain came from appending to the output buffer when converting from one base to another (instead of prepending) and reversing it at the end. I also changed some internal APIs to make it possible to pass preallocated buffers, and added the
Here are the numbers before the changes:
And the comparison:
Please take a look and let me know if anything should be changed.
I added another optimization for the