mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
- Pre-calculate normalized vector norms to avoid O(N^2) recalculation. - Pre-calculate normalized scores to avoid redundant property access and normalization. - Combine selection loops to reduce iteration overhead. - Modify cosineSimilarity to use dot product on normalized vectors. Benchmark (1000 items): ~240ms -> ~152ms (~37% improvement). Co-authored-by: PR0M3TH3AN <[email protected]>