f4b6a3 / uuid-creator

UUID Creator is a Java library for generating Universally Unique Identifiers.
MIT License
430 stars 44 forks source link

Add a faster parser for GUID #81

Closed fabiolimace closed 1 year ago

fabiolimace commented 1 year ago

The new parser should be faster than UUID.fromString(string).

Also add a validation logic without regular expression.

fabiolimace commented 1 year ago

Implemented the new parser.

The new parser, used by new GUID(string), is almost twice as fast as UUID.fromString(string).

It is also as fast as StringCodec.INSTANCE.decode(string).

Benchmark results:

Benchmark            Mode  Cnt      Score      Error   Units
GUID_parse          thrpt    5  18015,522 ± 2205,740  ops/ms
StringCodec_decode  thrpt    5  18109,898 ± 3952,417  ops/ms
UUID_fromString     thrpt    5   9706,639 ± 1203,893  ops/ms

In addition, the regular expression dependency was removed from GUID.valid(string).

fabiolimace commented 1 year ago

Released v5.3.2! 🎉