ulid-ruby icon indicating copy to clipboard operation
ulid-ruby copied to clipboard

Use Enumerable#to_h to avoid extra allocation

Open the-spectator opened this issue 2 years ago • 0 comments

We can avoid extra allocation by directly calling #to_h on ENCODING.split('').each_with_index instead of first converting it to an array and then converting it to a hash.

This is not a Hot path for this library as constants are generated only on load. Please feel free to close the PR if this qualifies as a cosmetic change.

the-spectator avatar Mar 14 '23 19:03 the-spectator