Closed bbrtj closed 2 years ago
My last commit decreases readability of _zero_pad
a bit, but I now pretty consistently get over 20% speedup in text ulid and close to 30% in binary ulid, for example:
Rate old (text) new (text)
old (text) 103910/s -- -18%
new (text) 126929/s 22% --
Rate old (binary) new (binary)
old (binary) 304464/s -- -22%
new (binary) 390046/s 28% --
(not creating lexical variable $value
would make for an even bigger gain, but it would be hard to read. I think current code is a nice middle ground)
Used better algorithm for
_zero_pad
and some minor refactors in encoder and decoder.This set of changes improves ulid generation performance by 15 - 20%: