-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Summary
WASM SDK decryption performance is significantly slower than the JS SDK, taking 466.5ms compared to JS SDK's 202.7ms (2.3x slower).
Benchmark Environment
- Platform: macOS (Apple Silicon)
- Browser: Chromium 141.0.7390.37
- Test Message: 39 bytes
- Network: localhost (minimal latency)
- Test Framework: Playwright E2E
Performance Metrics
| Implementation | Decryption Time |
|---|---|
| JS SDK | 202.7ms |
| WASM | 466.5ms |
| Difference | +130% slower |
Analysis
The WASM decryption includes:
- Full KAS rewrap protocol
- RSA-OAEP key unwrapping
- JWT signing with ES256
- AES-256-GCM decryption
Suspected bottlenecks:
- JWT signing operations - May not be optimized
- RSA key operations - Potentially using slower algorithms
- Network requests - Possibly not reusing connections
- Token caching - May not be caching KAS responses
Expected Outcome
WASM should match or exceed JS SDK performance for decryption, ideally:
- Target: <200ms for 39-byte payload
- Stretch goal: <150ms (faster than JS SDK)
Suggested Optimizations
- Connection Pooling: Reuse HTTP connections to KAS
- Token Caching: Cache KAS rewrap responses where possible
- Crypto Optimization: Use browser's WebCrypto API via wasm-bindgen where appropriate
- JWT Optimization: Optimize ES256 signing performance
- Async Operations: Ensure all I/O is truly non-blocking
Test Repository
Full benchmark available at: wasm-vs-js comparison app
Metadata
Metadata
Assignees
Labels
No labels