Commit e95f125
committed
Optimize time masks and schedule generation
Replace per-slot looping with a BigInt range-mask in meetingTimesToBinaryMask for faster mask construction and remove the now-unused helper. Introduce generateCombinations.ts: an optimized, iterative combination generator with prefix/skip logic and a MAX_RESULTS cap to avoid runaway generation. Update generateSchedules to use the new generator, precompute optional section masks, and rewrite addOptionalCourses to thread a combined bigint mask and respect MAX_RESULTS for early exit. Add extensive unit/benchmark tests to validate performance and correctness across many scenarios.1 parent 3c72c58 commit e95f125
6 files changed
Lines changed: 1657 additions & 165 deletions
File tree
- apps/searchneu/lib/scheduler
- binaryMeetingTimeTests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 21 | | |
29 | 22 | | |
30 | | - | |
| 23 | + | |
| 24 | + | |
31 | 25 | | |
32 | 26 | | |
33 | | - | |
| 27 | + | |
34 | 28 | | |
35 | 29 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
39 | 34 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 35 | + | |
| 36 | + | |
44 | 37 | | |
45 | 38 | | |
46 | 39 | | |
| |||
0 commit comments