f4b6a3 / uuid-creator

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

Optimize uuid codecs #38

Closed fabiolimace closed 3 years ago

fabiolimace commented 3 years ago

Optimized base-n codecs

Optimized other codecs

Other changes

Benchmark BEFORE optimization (v3.6.0)

Benchmark                  Mode  Cnt      Score     Error   Units
Throughput.decode_base16  thrpt    5   1329,156 ±   8,629  ops/ms
Throughput.decode_base32  thrpt    5    878,372 ±  16,539  ops/ms
Throughput.decode_base64  thrpt    5    535,601 ±   4,441  ops/ms
Throughput.encode_base16  thrpt    5  16135,294 ± 121,771  ops/ms
Throughput.encode_base32  thrpt    5  17459,509 ± 113,893  ops/ms
Throughput.encode_base64  thrpt    5  19427,255 ± 277,149  ops/ms

Benchmark                  Mode  Cnt      Score     Error   Units
Throughput.decode_ncname  thrpt    5    515,425 ±   4,243  ops/ms
Throughput.decode_slug    thrpt    5    531,003 ±   4,578  ops/ms
Throughput.decode_string  thrpt    5  10349,750 ± 152,409  ops/ms
Throughput.decode_uri     thrpt    5   8032,257 ±  56,649  ops/ms
Throughput.encode_ncname  thrpt    5   9666,939 ± 202,229  ops/ms
Throughput.encode_slug    thrpt    5  17833,465 ± 501,165  ops/ms
Throughput.encode_string  thrpt    5  21366,046 ± 216,510  ops/ms
Throughput.encode_uri     thrpt    5   2864,692 ±  37,637  ops/ms

Benchmark AFTER optimization (> v3.6.0)

Benchmark                  Mode  Cnt      Score     Error   Units
Throughput.decode_base16  thrpt    5   3222,914 ±  33,809  ops/ms
Throughput.decode_base32  thrpt    5   2537,134 ±  47,252  ops/ms
Throughput.decode_base64  thrpt    5   1758,213 ±  16,912  ops/ms
Throughput.encode_base16  thrpt    5  18551,661 ± 429,523  ops/ms
Throughput.encode_base32  thrpt    5  19522,694 ± 260,718  ops/ms
Throughput.encode_base64  thrpt    5  22156,893 ± 219,649  ops/ms

Benchmark                  Mode  Cnt      Score     Error   Units
Throughput.decode_ncname  thrpt    5   1703,910 ±   6,322  ops/ms
Throughput.decode_slug    thrpt    5   1603,126 ±  20,051  ops/ms
Throughput.decode_string  thrpt    5  10377,743 ±  86,326  ops/ms
Throughput.decode_uri     thrpt    5   7954,467 ±  83,632  ops/ms
Throughput.encode_ncname  thrpt    5   7076,385 ±  79,923  ops/ms
Throughput.encode_slug    thrpt    5  19747,374 ± 194,295  ops/ms
Throughput.encode_string  thrpt    5  21746,800 ± 268,137  ops/ms
Throughput.encode_uri     thrpt    5   2934,557 ±  36,493  ops/ms