RobThree / NUlid

.Net ULID implementation
MIT License
364 stars 25 forks source link

Possible improvements from Cysharp/Ulid #23

Open TimothyMakkison opened 1 year ago

TimothyMakkison commented 1 year ago

Created a pull request with some potential optimizations/code modernisation for Cysharp/Ulidd. Not sure if any changes would apply here, it looks like NUlid and Ulid serialize to Guid in different ways (not 100% sure only glanced at it).

I meant to check if any improvements would apply to NUlid and create a pr, but I've been busy so I'll just dump the work on you 😆

RobThree commented 1 year ago

I just merged #22, I'll see, at a later date, if something in your PR applies to this. Thanks!

TimothyMakkison commented 1 year ago

At a glance the get DateTimeOffset optimisation might apply.

My vectorized decode CrockfordBase32 is faster than the manual version, with some slight modifications (currently turns invalid characters into 31) it would probably be an improvement on your current Parse(ReadOnlySpan<char> span). This was more of POC so there are definitely improvements to be made.