From 2957046c6e398d52ded17f8822b18d0f272effa4 Mon Sep 17 00:00:00 2001 From: Matteo Pietro Dazzi Date: Tue, 12 Nov 2024 20:37:09 +0100 Subject: [PATCH] feat: verify node rs --- README.md | 144 +++++++++++++++++++++++++++--------------------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 973500e..3dbaa30 100644 --- a/README.md +++ b/README.md @@ -376,78 +376,78 @@ Note that for decoding the algorithm is irrelevant, so only one was measured. ### Verifying ``` -╔═════════════════════════════════════╤═════════╤══════════════════╤═══════════╤═════════════════════════╗ -║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ HS512 - jsonwebtoken (sync) │ 10000 │ 49275.12 op/sec │ ± 1.41 % │ ║ -║ HS512 - fast-jwt (async) │ 10000 │ 51353.81 op/sec │ ± 2.98 % │ + 4.22 % ║ -║ HS512 - jsonwebtoken (async) │ 10000 │ 51610.98 op/sec │ ± 1.51 % │ + 4.74 % ║ -║ HS512 - jose (sync) │ 10000 │ 64280.92 op/sec │ ± 1.73 % │ + 30.45 % ║ -║ HS512 - fast-jwt (sync) │ 10000 │ 75067.57 op/sec │ ± 2.40 % │ + 52.34 % ║ -║ HS512 - fast-jwt (async with cache) │ 10000 │ 175013.21 op/sec │ ± 4.42 % │ + 255.18 % ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ HS512 - fast-jwt (sync with cache) │ 10000 │ 207199.64 op/sec │ ± 3.15 % │ + 320.50 % ║ -╚═════════════════════════════════════╧═════════╧══════════════════╧═══════════╧═════════════════════════╝ - -╔═════════════════════════════════════╤═════════╤══════════════════╤═══════════╤═════════════════════════╗ -║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ ES512 - fast-jwt (async) │ 1000 │ 561.01 op/sec │ ± 0.44 % │ ║ -║ ES512 - jsonwebtoken (sync) │ 1000 │ 573.52 op/sec │ ± 0.27 % │ + 2.23 % ║ -║ ES512 - jsonwebtoken (async) │ 1000 │ 573.74 op/sec │ ± 0.26 % │ + 2.27 % ║ -║ ES512 - fast-jwt (sync) │ 1000 │ 597.68 op/sec │ ± 0.30 % │ + 6.54 % ║ -║ ES512 - jose (sync) │ 1000 │ 604.42 op/sec │ ± 0.27 % │ + 7.74 % ║ -║ ES512 - fast-jwt (async with cache) │ 10000 │ 189999.48 op/sec │ ± 4.49 % │ + 33767.60 % ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ ES512 - fast-jwt (sync with cache) │ 10000 │ 192353.61 op/sec │ ± 4.79 % │ + 34187.22 % ║ -╚═════════════════════════════════════╧═════════╧══════════════════╧═══════════╧═════════════════════════╝ - -╔═════════════════════════════════════╤═════════╤══════════════════╤═══════════╤═════════════════════════╗ -║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ RS512 - jsonwebtoken (async) │ 1500 │ 7551.10 op/sec │ ± 0.92 % │ ║ -║ RS512 - jsonwebtoken (sync) │ 4500 │ 7750.46 op/sec │ ± 0.96 % │ + 2.64 % ║ -║ RS512 - fast-jwt (async) │ 1000 │ 8413.41 op/sec │ ± 0.99 % │ + 11.42 % ║ -║ RS512 - jose (sync) │ 4500 │ 12382.58 op/sec │ ± 0.94 % │ + 63.98 % ║ -║ RS512 - fast-jwt (sync) │ 4500 │ 12665.45 op/sec │ ± 0.90 % │ + 67.73 % ║ -║ RS512 - fast-jwt (sync with cache) │ 10000 │ 145107.65 op/sec │ ± 7.54 % │ + 1821.68 % ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ RS512 - fast-jwt (async with cache) │ 10000 │ 158780.83 op/sec │ ± 3.90 % │ + 2002.75 % ║ -╚═════════════════════════════════════╧═════════╧══════════════════╧═══════════╧═════════════════════════╝ - -╔═════════════════════════════════════╤═════════╤══════════════════╤═══════════╤═════════════════════════╗ -║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ PS512 - jsonwebtoken (async) │ 2500 │ 7240.21 op/sec │ ± 0.89 % │ ║ -║ PS512 - jsonwebtoken (sync) │ 2000 │ 7449.38 op/sec │ ± 0.91 % │ + 2.89 % ║ -║ PS512 - fast-jwt (async) │ 1500 │ 8301.99 op/sec │ ± 0.81 % │ + 14.67 % ║ -║ PS512 - jose (sync) │ 4000 │ 11944.57 op/sec │ ± 0.99 % │ + 64.98 % ║ -║ PS512 - fast-jwt (sync) │ 1000 │ 12881.96 op/sec │ ± 0.76 % │ + 77.92 % ║ -║ PS512 - fast-jwt (async with cache) │ 10000 │ 155603.59 op/sec │ ± 4.27 % │ + 2049.16 % ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ PS512 - fast-jwt (sync with cache) │ 10000 │ 172097.91 op/sec │ ± 4.58 % │ + 2276.97 % ║ -╚═════════════════════════════════════╧═════════╧══════════════════╧═══════════╧═════════════════════════╝ - -╔═════════════════════════════════════╤═════════╤══════════════════╤═══════════╤═════════════════════════╗ -║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ EdDSA - fast-jwt (async) │ 1000 │ 6370.58 op/sec │ ± 0.59 % │ ║ -║ EdDSA - jose (sync) │ 1000 │ 6538.90 op/sec │ ± 0.83 % │ + 2.64 % ║ -║ EdDSA - fast-jwt (sync) │ 1000 │ 7078.93 op/sec │ ± 0.87 % │ + 11.12 % ║ -║ EdDSA - fast-jwt (async with cache) │ 10000 │ 177457.09 op/sec │ ± 5.36 % │ + 2685.57 % ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ -╟─────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ -║ EdDSA - fast-jwt (sync with cache) │ 10000 │ 202628.41 op/sec │ ± 3.12 % │ + 3080.69 % ║ -╚═════════════════════════════════════╧═════════╧══════════════════╧═══════════╧═════════════════════════╝ +╔═══════════════════════════════════════╤═════════╤══════════════════╤═══════════╤═════════════════════════╗ +║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ HS512 - jsonwebtoken (async) │ 1000 │ 3643.83 op/sec │ ± 0.30 % │ ║ +║ HS512 - jsonwebtoken (sync) │ 1000 │ 3663.59 op/sec │ ± 0.44 % │ + 0.54 % ║ +║ HS512 - @node-rs/jsonwebtoken (async) │ 2000 │ 84971.86 op/sec │ ± 0.95 % │ + 2231.94 % ║ +║ HS512 - jose (sync) │ 1000 │ 112085.71 op/sec │ ± 0.91 % │ + 2976.04 % ║ +║ HS512 - fast-jwt (async) │ 10000 │ 120363.11 op/sec │ ± 4.74 % │ + 3203.21 % ║ +║ HS512 - fast-jwt (sync) │ 2000 │ 196243.45 op/sec │ ± 0.81 % │ + 5285.64 % ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ HS512 - @node-rs/jsonwebtoken (sync) │ 1500 │ 243140.80 op/sec │ ± 0.76 % │ + 6572.68 % ║ +╚═══════════════════════════════════════╧═════════╧══════════════════╧═══════════╧═════════════════════════╝ + +╔═══════════════════════════════════════╤═════════╤══════════════════╤═══════════╤═════════════════════════╗ +║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ ES512 - jsonwebtoken (sync) │ 1000 │ 508.65 op/sec │ ± 0.24 % │ ║ +║ ES512 - jsonwebtoken (async) │ 1000 │ 516.55 op/sec │ ± 0.28 % │ + 1.55 % ║ +║ ES512 - fast-jwt (async) │ 1000 │ 531.83 op/sec │ ± 0.17 % │ + 4.56 % ║ +║ ES512 - fast-jwt (sync) │ 1000 │ 650.10 op/sec │ ± 0.18 % │ + 27.81 % ║ +║ ES512 - jose (sync) │ 1000 │ 659.42 op/sec │ ± 0.13 % │ + 29.64 % ║ +║ ES512 - @node-rs/jsonwebtoken (async) │ 5000 │ 83724.21 op/sec │ ± 0.96 % │ + 16359.99 % ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ ES512 - @node-rs/jsonwebtoken (sync) │ 4000 │ 248971.42 op/sec │ ± 0.96 % │ + 48847.23 % ║ +╚═══════════════════════════════════════╧═════════╧══════════════════╧═══════════╧═════════════════════════╝ + +╔═══════════════════════════════════════╤═════════╤═══════════════╤═══════════╤═════════════════════════╗ +║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼───────────────┼───────────┼─────────────────────────╢ +║ RS512 - jsonwebtoken (async) │ 1000 │ 207.59 op/sec │ ± 0.13 % │ ║ +║ RS512 - fast-jwt (async) │ 1000 │ 211.79 op/sec │ ± 0.12 % │ + 2.03 % ║ +║ RS512 - jsonwebtoken (sync) │ 1000 │ 212.31 op/sec │ ± 0.11 % │ + 2.27 % ║ +║ RS512 - jose (sync) │ 1000 │ 274.84 op/sec │ ± 0.16 % │ + 32.40 % ║ +║ RS512 - fast-jwt (sync) │ 1000 │ 279.25 op/sec │ ± 0.15 % │ + 34.52 % ║ +║ RS512 - @node-rs/jsonwebtoken (async) │ 1000 │ 292.44 op/sec │ ± 0.05 % │ + 40.88 % ║ +╟───────────────────────────────────────┼─────────┼───────────────┼───────────┼─────────────────────────╢ +║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼───────────────┼───────────┼─────────────────────────╢ +║ RS512 - @node-rs/jsonwebtoken (sync) │ 1000 │ 293.68 op/sec │ ± 0.06 % │ + 41.47 % ║ +╚═══════════════════════════════════════╧═════════╧═══════════════╧═══════════╧═════════════════════════╝ + +╔═══════════════════════════════════════╤═════════╤═══════════════╤═══════════╤═════════════════════════╗ +║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼───────────────┼───────────┼─────────────────────────╢ +║ PS512 - jsonwebtoken (async) │ 1000 │ 211.44 op/sec │ ± 0.11 % │ ║ +║ PS512 - fast-jwt (async) │ 1000 │ 212.84 op/sec │ ± 0.10 % │ + 0.67 % ║ +║ PS512 - jsonwebtoken (sync) │ 1000 │ 214.02 op/sec │ ± 0.09 % │ + 1.22 % ║ +║ PS512 - jose (sync) │ 1000 │ 280.13 op/sec │ ± 0.14 % │ + 32.49 % ║ +║ PS512 - fast-jwt (sync) │ 1000 │ 281.55 op/sec │ ± 0.14 % │ + 33.16 % ║ +║ PS512 - @node-rs/jsonwebtoken (sync) │ 1000 │ 291.37 op/sec │ ± 0.29 % │ + 37.80 % ║ +╟───────────────────────────────────────┼─────────┼───────────────┼───────────┼─────────────────────────╢ +║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼───────────────┼───────────┼─────────────────────────╢ +║ PS512 - @node-rs/jsonwebtoken (async) │ 1000 │ 292.28 op/sec │ ± 0.09 % │ + 38.23 % ║ +╚═══════════════════════════════════════╧═════════╧═══════════════╧═══════════╧═════════════════════════╝ + +╔═══════════════════════════════════════╤═════════╤══════════════════╤═══════════╤═════════════════════════╗ +║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ EdDSA - fast-jwt (async) │ 1000 │ 2969.04 op/sec │ ± 0.61 % │ ║ +║ EdDSA - jose (sync) │ 10000 │ 24855.81 op/sec │ ± 1.20 % │ + 737.17 % ║ +║ EdDSA - fast-jwt (sync) │ 10000 │ 28710.81 op/sec │ ± 1.12 % │ + 867.01 % ║ +║ EdDSA - @node-rs/jsonwebtoken (async) │ 1000 │ 93635.27 op/sec │ ± 0.82 % │ + 3053.73 % ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║ +╟───────────────────────────────────────┼─────────┼──────────────────┼───────────┼─────────────────────────╢ +║ EdDSA - @node-rs/jsonwebtoken (sync) │ 1500 │ 264904.64 op/sec │ ± 0.99 % │ + 8822.24 % ║ +╚═══════════════════════════════════════╧═════════╧══════════════════╧═══════════╧═════════════════════════╝ ``` ## Contributing