mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
Replace inefficient `[...events].reverse().find()` with `events.findLast()`. This avoids a shallow copy of the array and an in-place reverse, improving performance from O(N) space/time to O(1) space and O(N) time (where N is the number of events searched). In benchmarks with 100,000 events: - Element near the end: 99.9% improvement (~0.8ms vs ~950ms) - Element at the beginning: ~42% improvement (~145ms vs ~250ms) Node.js v18.6.0+ is required for `findLast`, which is supported in the current environment (v22.22.0). Co-authored-by: PR0M3TH3AN <[email protected]>