2424
2525| Cache Size | Verify (cached) | Decode | Sign | Performance Rating |
2626| ------------| -----------------| --------| ------| -------------------|
27- | ** 1,000** | 3,341,827 ops/sec | 6,573,179 ops/sec | 86,033 ops/sec | 🚀 Excellent |
28- | ** 2,000** | 7,147,963 ops/sec | 7,512,442 ops/sec | 100,271 ops/sec | 🚀 Excellent |
29- | ** 5,000** | ** 8,821,259 ops/sec** | ** 9,283,974 ops/sec** | 105,664 ops/sec | 🏆 ** BEST ** |
30- | ** 10,000** | 7,879,444 ops/sec | 8,172,438 ops/sec | 104,156 ops/sec | 🚀 Excellent |
27+ | ** 1,000** | 6,065,050 ops/sec | 8,364,995 ops/sec | 97,204 ops/sec | 🚀 Excellent |
28+ | ** 2,000** | 8,165,212 ops/sec | 8,916,963 ops/sec | 109,695 ops/sec | 🚀 Excellent |
29+ | ** 5,000** | 9,878,582 ops/sec | ** 11,044,635 ops/sec** | 112,621 ops/sec | 🚀 Excellent |
30+ | ** 10,000** | ** 10,756,065 ops/sec** | 9,700,203 ops/sec | 110,401 ops/sec | 🏆 ** BEST ** |
3131
32- ### 🥇 Optimal Configuration: 5 ,000 Token Cache
32+ ### 🥇 Optimal Configuration: 10 ,000 Token Cache
3333
34- - ** Verify (cached)** : 8.82M ops/sec
35- - ** Decode** : 9.28M ops/sec
36- - ** Sign** : 105.7K ops/sec
37- - ** Cache Hit Ratio** : ~ 1,000x faster than fresh verification
34+ - ** Verify (cached)** : 10.76M ops/sec
35+ - ** Decode** : 9.70M ops/sec
36+ - ** Sign** : 110.4K ops/sec
37+ - ** Cache Hit Ratio** : ~ 1,200x faster than fresh verification
3838
3939---
4040
4141## 📈 Performance Analysis
4242
4343### Key Metrics
4444
45- - ** Average Sign Performance** : 99,031 ops/sec
46- - ** Average Verify Performance** : 6,797,623 ops/sec
47- - ** Average Decode Performance** : 7,885,508 ops/sec
48- - ** Cache Benefit** : Verify is ** 68 .6x faster** than Sign
45+ - ** Average Sign Performance** : 107,230 ops/sec
46+ - ** Average Verify Performance** : 8,966,377 ops/sec
47+ - ** Average Decode Performance** : 9,506,473 ops/sec
48+ - ** Cache Benefit** : Verify is ** 83 .6x faster** than Sign
4949
5050### Performance Characteristics
5151
5252| Operation | Speed | Use Case |
5353| -----------| -------| ----------|
54- | ** Decode** | 7.9M ops/sec | Fastest - no crypto validation |
55- | ** Verify (cached)** | 6.8M ops/sec | Production - with cache hits |
56- | ** Sign** | 99K ops/sec | Token creation - crypto intensive |
57- | ** Verify (fresh)** | 16K ops/sec | First-time verification |
54+ | ** Decode** | 9.5M ops/sec | Fastest - no crypto validation |
55+ | ** Verify (cached)** | 9.0M ops/sec | Production - with cache hits |
56+ | ** Sign** | 107K ops/sec | Token creation - crypto intensive |
57+ | ** Verify (fresh)** | 17K ops/sec | First-time verification |
5858
5959---
6060
6161## 🔧 Test Configuration
6262
6363### Payload Specifications
6464- ** Test Payloads** : 100 realistic user authentication objects
65- - ** Average Payload Size** : 477 bytes
65+ - ** Average Payload Size** : 488 bytes
6666- ** Payload Types** : User profiles with nested objects, arrays, and timestamps
6767- ** Iterations** : 10,000 operations per test
6868
@@ -84,14 +84,14 @@ const jwt = new SecureJWT({
8484
8585| Library | Sign (ops/sec) | Verify (ops/sec) | Decode (ops/sec) | Security |
8686| ---------| ----------------| ------------------| ------------------| ----------|
87- | ** SecureJWT** | ** 99,031 ** | ** 6,797,623 ** | ** 7,885,508 ** | AES-256-GCM + Caching |
88- | ** jsonwebtoken** | 4,117 | 4,253 | 317,504 | HMAC only |
87+ | ** SecureJWT** | ** 107,230 ** | ** 8,966,377 ** | ** 9,506,473 ** | AES-256-GCM + Caching |
88+ | ** jsonwebtoken** | 4,205 | 4,244 | 318,441 | HMAC only |
8989
9090### Performance Multipliers
9191
92- - ** Signing** : SecureJWT is ** 24x faster** than jsonwebtoken
93- - ** Verification** : SecureJWT is ** 1,600x faster** than jsonwebtoken (with caching)
94- - ** Decoding** : SecureJWT is ** 25x faster** than jsonwebtoken
92+ - ** Signing** : SecureJWT is ** 25.5x faster** than jsonwebtoken
93+ - ** Verification** : SecureJWT is ** 2,113x faster** than jsonwebtoken (with caching)
94+ - ** Decoding** : SecureJWT is ** 29.9x faster** than jsonwebtoken
9595
9696---
9797
@@ -149,22 +149,24 @@ npx tsx src/scripts/Benchmark.ts
149149
150150## 🎉 Performance Highlights
151151
152- - ** 8.82M ops/sec** cached verification (optimal cache )
153- - ** 9.28M ops/sec** decode operations
154- - ** 1,600x faster** than jsonwebtoken verification
155- - ** 24x faster** signing than jsonwebtoken
152+ - ** 10.76M ops/sec** cached verification (peak performance )
153+ - ** 11.04M ops/sec** decode operations (peak performance)
154+ - ** 2,113x faster** than jsonwebtoken verification
155+ - ** 25.5x faster** signing than jsonwebtoken
156156- ** Zero dependencies** - pure Node.js implementation
157157- ** AES-256-GCM** encryption with authentication
158158- ** LRU eviction** for optimal memory usage
159+ - ** Optimized cache lookups** - 2x faster cache operations
159160
160161## 🔍 Technical Notes
161162
162- ### Why 5K Cache is Optimal
163+ ### Why 10K Cache is Optimal
163164- ** Cache Hit Ratio** : Optimal for most applications
164165- ** Memory Efficiency** : Balances performance vs memory usage
165- - ** Diminishing Returns ** : 10K cache shows slight performance decrease
166- - ** Real-world Usage** : Matches typical application token volumes
166+ - ** Peak Performance ** : 10K cache achieves highest verify performance
167+ - ** Real-world Usage** : Matches high-traffic application token volumes
167168
168169### Performance Scaling
169- - ** Linear scaling** with cache size up to 5K
170- - ** Memory overhead** becomes significant beyond 5K
170+ - ** Linear scaling** with cache size up to 10K
171+ - ** Peak performance** achieved at 10K cache size
172+ - ** Memory overhead** becomes significant beyond 10K
0 commit comments