f4b6a3 / uuid-creator

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

Add more test cases for base-n codecs #42

Closed fabiolimace closed 3 years ago

fabiolimace commented 3 years ago

Added more tests for base-n codecs. The decoding speed was increased for base-36, base-58, and base-62. But encoding speed was decreased for the same codecs. It's still very good.

List of changes:

Benchmarks before:

------------------------------------------------------------------
Benchmark                  Mode  Cnt      Score     Error   Units
------------------------------------------------------------------
-Throughput.decode_base36  thrpt    5   4598,355 ±  60,168  ops/ms
-Throughput.decode_base58  thrpt    5   5125,792 ±  64,979  ops/ms
-Throughput.decode_base62  thrpt    5   5157,235 ±  40,137  ops/ms
------------------------------------------------------------------
-Throughput.encode_base36  thrpt    5   1077,678 ±   9,852  ops/ms
-Throughput.encode_base58  thrpt    5   1201,396 ±  25,900  ops/ms
-Throughput.encode_base62  thrpt    5   1218,330 ±  14,767  ops/ms
------------------------------------------------------------------

Benchmarks after:

------------------------------------------------------------------
Benchmark                  Mode  Cnt      Score     Error   Units
------------------------------------------------------------------
Throughput.decode_base36  thrpt    5   5549,047 ±  63,524  ops/ms
Throughput.decode_base58  thrpt    5   6387,853 ± 127,972  ops/ms
Throughput.decode_base62  thrpt    5   6333,792 ± 164,613  ops/ms
------------------------------------------------------------------
Throughput.encode_base36  thrpt    5    736,239 ±  12,396  ops/ms
Throughput.encode_base58  thrpt    5    835,961 ±  25,055  ops/ms
Throughput.encode_base62  thrpt    5    836,418 ±  24,241  ops/ms
------------------------------------------------------------------

Test coverage: 90.0%

fabiolimace commented 3 years ago

Released version 3.7.2.