mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-25 23:24:03 +00:00
Optimizations (1.7-2x speedup across all hot paths): - biomarker.js: Replace O(n) findIndex with pre-built RSID_INDEX Map for O(1) SNP lookups; cache LPA SNP references to avoid repeated array iteration in vector encoding and population generation - stream.js: Add RingBuffer.pushPop() returning evicted value; replace O(n) windowMeanStd buffer scan with O(1) incremental windowed Welford algorithm in StreamProcessor Benchmark improvements (before → after): computeRiskScores: 7.33 → 3.70 us/op (1.98x) encodeProfileVector: 9.51 → 5.25 us/op (1.81x) StreamProcessor.processReading: 220 → 110 us/op (2.00x) generateSyntheticPopulation(100): 1090 → 595 us/op (1.83x) Real-data integration tests (25 new tests): - 4 realistic 23andMe fixture files (29 SNPs each) covering: high-risk cardio, low-risk baseline, multi-risk, PCSK9-protective - End-to-end pipeline: parse 23andMe → biomarker scoring → streaming - Clinical scenarios: APOE e4/e4, BRCA1 carrier, MTHFR compound het, COMT×OPRM1 pain, DRD2×COMT, PCSK9 protective - Cross-validation: 8 JS↔Rust parity assertions on tables, z-scores, classification, vector layout, risk thresholds - Population correlations: APOE→HDL, LPA→Lp(a), score distribution, clinical biomarker range validation (500 subjects) - Full pipeline benchmark: 220 us end-to-end https://claude.ai/code/session_014FpaYVohmyLH5dcBZTgmSY |
||
|---|---|---|
| .. | ||
| fixtures | ||
| test-biomarker.js | ||
| test-real-data.js | ||