mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 08:22:24 +00:00
Replaces the scroll event listener and `getBoundingClientRect` polling with `IntersectionObserver` to eliminate layout thrashing and improve scrolling performance. - Removes `window.onscroll` handler in `docsView.js`. - Implements `IntersectionObserver` with `rootMargin` to track active headings. - Retains initial one-time scan for correct state on load. - Adds benchmark `benchmarks/docs_scroll_spy.html` and `benchmarks/docs_scroll_spy_bench.js`. Benchmark results: - Legacy: ~0.065ms/call (200 calls) -> Total ~13ms CPU (sync layout thrashing) - Optimized: ~0.028ms/call (32 calls) -> Total ~0.9ms CPU - 14x improvement in CPU time for scroll handler logic. Co-authored-by: PR0M3TH3AN <[email protected]>