1 Commits
Author SHA1 Message Date
google-labs-jules[bot]andPR0M3TH3AN b70c72faa4 ⚡ Optimize DM decryption with parallel execution
Refactors `decryptLegacyDm` in `js/dmDecryptor.js` to execute decryption attempts in parallel using `Promise.any`, replacing the sequential nested loop approach.

Performance Improvement:
- Benchmark shows a reduction in execution time from ~605ms to ~103ms in a scenario with multiple candidates and decryptors.
- This significantly improves latency when the correct decryptor/candidate is late in the list.

Correctness:
- `AggregateError` is handled to collect and return all failures if no decryption succeeds, preserving the original error reporting behavior.
- Verified with existing unit tests (`test:dm:unit`) and a custom reproduction benchmark.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-05 19:39:34 +00:00