Skip to content

JWT decode benchmarks

Generated 2026-11-10 from bench/results-docker/ by bench/compare.py, on AWS m9g.2xlarge, Graviton5 (aarch64), Linux. Run in Docker, one container per library, each limited to 1 CPU (pinned) and 500 MB with no swap. Each case gets 1,000 untimed decodes, then 10,000 timed.

Each decode verifies an HS256 signature and checks exp and aud, as a real caller would. Times are µs per decode: the mean over 10,000 decodes of the same token, after 1,000 untimed (lower is better); (Nx) is the speed-up vs pyjwt 2.15.1.

Typical token (661 B, 64-byte key)

library µs per decode vs pyjwt 2.15.1
ryjwt 0.3.1 → Struct 1.37 28.1x
ryjwt 0.3.1 → dict (msgspec) 1.48 26.0x
ryjwt 0.3.1 → dict (jiter) 1.70 22.7x
ryjwt 0.3.1 → BaseModel 2.74 14.1x
jsonwebtoken 11.1.0 (aws-lc-rs) → struct 3.20 12.1x
jsonwebtoken 11.1.0 (aws-lc-rs) → Value 3.79 10.2x
fast-jwt 6.3.3 5.13 7.5x
jose 6.2.12 12.83 3.0x
joserfc 1.7.7 18.97 2.0x
pyjwt 2.15.1 38.55 1.0x

Every token and key size

Fastest per row in bold.

case token B key B ryjwt 0.3.1 → Struct ryjwt 0.3.1 → dict (msgspec) ryjwt 0.3.1 → dict (jiter) ryjwt 0.3.1 → BaseModel jsonwebtoken 11.1.0 (aws-lc-rs) → struct jsonwebtoken 11.1.0 (aws-lc-rs) → Value fast-jwt 6.3.3 jose 6.2.12 joserfc 1.7.7 pyjwt 2.15.1
small-k32 231 32 0.71 (33.8x) 0.67 (35.8x) 0.76 (31.4x) 1.31 (18.3x) 1.52 (15.7x) 1.80 (13.3x) 7.80 (3.1x) 17.94 (1.3x) 15.00 (1.6x) 23.89 (1.0x)
small-k64 231 64 0.70 (34.6x) 0.67 (36.3x) 0.75 (32.2x) 1.30 (18.7x) 1.53 (15.8x) 1.80 (13.5x) 6.25 (3.9x) 11.62 (2.1x) 14.82 (1.6x) 24.24 (1.0x)
small-k256 231 256 0.70 (37.1x) 0.67 (38.8x) 0.75 (34.4x) 1.30 (20.0x) 1.68 (15.5x) 1.97 (13.2x) 3.17 (8.2x) 10.89 (2.4x) 14.99 (1.7x) 25.98 (1.0x)
small-k4096 231 4096 0.70 (76.8x) 0.67 (80.8x) 0.76 (70.3x) 1.30 (41.3x) 3.51 (15.3x) 3.77 (14.3x) 8.76 (6.1x) 17.42 (3.1x) 16.85 (3.2x) 53.75 (1.0x)
typical-k32 661 32 1.37 (28.2x) 1.49 (25.9x) 1.71 (22.6x) 2.73 (14.2x) 3.19 (12.1x) 3.78 (10.2x) 5.01 (7.7x) 12.50 (3.1x) 19.01 (2.0x) 38.67 (1.0x)
typical-k64 661 64 1.37 (28.1x) 1.48 (26.0x) 1.70 (22.7x) 2.74 (14.1x) 3.20 (12.1x) 3.79 (10.2x) 5.13 (7.5x) 12.83 (3.0x) 18.97 (2.0x) 38.55 (1.0x)
typical-k256 661 256 1.39 (29.1x) 1.48 (27.2x) 1.73 (23.3x) 2.73 (14.8x) 3.36 (12.0x) 3.94 (10.2x) 5.55 (7.3x) 17.65 (2.3x) 19.18 (2.1x) 40.32 (1.0x)
typical-k4096 661 4096 1.38 (50.0x) 1.49 (46.3x) 1.72 (40.0x) 2.73 (25.2x) 5.18 (13.3x) 5.75 (12.0x) 7.80 (8.8x) 15.27 (4.5x) 20.98 (3.3x) 68.81 (1.0x)
medium-k32 2244 32 2.81 (31.5x) 4.16 (21.2x) 4.56 (19.4x) 3.77 (23.5x) 6.64 (13.3x) 10.13 (8.7x) 10.35 (8.5x) 18.30 (4.8x) 30.01 (2.9x) 88.37 (1.0x)
medium-k64 2244 64 2.81 (31.5x) 4.16 (21.3x) 4.56 (19.5x) 3.75 (23.6x) 6.64 (13.4x) 10.12 (8.8x) 7.89 (11.2x) 17.70 (5.0x) 30.05 (3.0x) 88.65 (1.0x)
medium-k256 2244 256 2.80 (32.2x) 4.15 (21.8x) 4.54 (19.9x) 3.75 (24.1x) 6.82 (13.3x) 10.22 (8.8x) 8.24 (11.0x) 18.66 (4.8x) 30.21 (3.0x) 90.32 (1.0x)
medium-k4096 2244 4096 2.81 (42.1x) 4.15 (28.4x) 4.55 (25.9x) 3.76 (31.4x) 8.64 (13.7x) 12.09 (9.8x) 10.38 (11.4x) 19.89 (5.9x) 32.11 (3.7x) 118.03 (1.0x)
large-k32 20884 32 21.98 (33.0x) 38.73 (18.8x) 40.02 (18.1x) 25.84 (28.1x) 53.61 (13.5x) 94.00 (7.7x) 75.72 (9.6x) 94.56 (7.7x) 163.27 (4.4x) 726.24 (1.0x)
large-k64 20884 64 21.97 (33.1x) 38.71 (18.8x) 40.04 (18.2x) 25.80 (28.2x) 53.86 (13.5x) 94.93 (7.7x) 75.37 (9.6x) 93.93 (7.7x) 163.72 (4.4x) 726.81 (1.0x)
large-k256 20884 256 22.14 (32.9x) 38.60 (18.9x) 39.66 (18.4x) 25.82 (28.2x) 53.97 (13.5x) 94.62 (7.7x) 75.33 (9.7x) 93.94 (7.8x) 163.68 (4.5x) 728.69 (1.0x)
large-k4096 20884 4096 21.96 (34.4x) 38.74 (19.5x) 40.02 (18.9x) 25.81 (29.3x) 55.94 (13.5x) 96.02 (7.9x) 77.28 (9.8x) 96.20 (7.8x) 165.69 (4.6x) 755.07 (1.0x)