Commit f46a61a
authored
perf(ledger): stream rows to disk instead of collecting them first (#155)
Scoring built the whole ledger as a `Vec<CallRecord>` and wrote it afterwards.
Every resolved row carries the recorded side's full `args` and `result`, so a run
with thousands of resolved calls held a second copy of its own recording in
memory, alongside the parsed lookup table and record graph, before a byte reached
disk.
That is what OOMKilled the runner. Established by controlled comparison rather
than by argument: on one 287-correlation recording, at one 16Gi limit, with one
deja build, the candidate with the `imc` seam disabled COMPLETES in 1m51 while
the unmodified candidate dies at 16Gi. Same 214 MB lookup table, same 100
correlations driven, same 67s seeding, same 8s driving. The only difference is
what the ledger holds: 82 resolved calls against thousands, because the disabled
seam makes almost every row `omitted` or `pruned_subtree` and those carry no
payload.
Every other explanation was eliminated by test first: table size (the passing run
loads the same one), deja revision (same build), correlation count (a
427-correlation recording scores in 88s), render and scoping (3.2s, timed), the
`Expected` result clone (removed in #152, still OOMs), and a hang (exit 137, the
container terminated).
`build_with_inconclusive` and `build_with_plan` now emit through a sink; the
collecting form is kept for `build_ledger`, which the `/calls` API genuinely
needs whole. `detect_and_score` streams straight into a `BufWriter`, so peak is
bounded by one row rather than by the run. Flat-tier rows stream first, exactly
as the collecting version ordered them.
Behaviour is unchanged — 443 tests pass, including the two that assert the
scorecard and the ledger classify identically, which is what would break if the
row set or its order moved.1 parent 5f18679 commit f46a61a
2 files changed
Lines changed: 100 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
| |||
207 | 209 | | |
208 | 210 | | |
209 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
210 | 245 | | |
211 | 246 | | |
212 | 247 | | |
| |||
222 | 257 | | |
223 | 258 | | |
224 | 259 | | |
225 | | - | |
226 | 260 | | |
227 | 261 | | |
228 | 262 | | |
| |||
274 | 308 | | |
275 | 309 | | |
276 | 310 | | |
277 | | - | |
| 311 | + | |
278 | 312 | | |
279 | 313 | | |
280 | 314 | | |
| |||
287 | 321 | | |
288 | 322 | | |
289 | 323 | | |
290 | | - | |
| 324 | + | |
291 | 325 | | |
292 | 326 | | |
293 | 327 | | |
| |||
366 | 400 | | |
367 | 401 | | |
368 | 402 | | |
369 | | - | |
| 403 | + | |
370 | 404 | | |
371 | 405 | | |
372 | 406 | | |
| |||
384 | 418 | | |
385 | 419 | | |
386 | 420 | | |
387 | | - | |
| 421 | + | |
388 | 422 | | |
389 | 423 | | |
390 | 424 | | |
| |||
423 | 457 | | |
424 | 458 | | |
425 | 459 | | |
426 | | - | |
| 460 | + | |
427 | 461 | | |
428 | 462 | | |
429 | 463 | | |
| |||
436 | 470 | | |
437 | 471 | | |
438 | 472 | | |
439 | | - | |
| 473 | + | |
440 | 474 | | |
441 | 475 | | |
442 | 476 | | |
| |||
452 | 486 | | |
453 | 487 | | |
454 | 488 | | |
455 | | - | |
| 489 | + | |
456 | 490 | | |
457 | 491 | | |
458 | 492 | | |
| |||
465 | 499 | | |
466 | 500 | | |
467 | 501 | | |
468 | | - | |
| 502 | + | |
469 | 503 | | |
470 | 504 | | |
471 | | - | |
| 505 | + | |
472 | 506 | | |
473 | 507 | | |
474 | 508 | | |
475 | 509 | | |
476 | 510 | | |
477 | 511 | | |
478 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
479 | 525 | | |
480 | 526 | | |
481 | 527 | | |
482 | 528 | | |
483 | 529 | | |
484 | 530 | | |
485 | 531 | | |
486 | | - | |
| 532 | + | |
| 533 | + | |
487 | 534 | | |
488 | 535 | | |
489 | 536 | | |
| |||
496 | 543 | | |
497 | 544 | | |
498 | 545 | | |
499 | | - | |
| 546 | + | |
500 | 547 | | |
501 | 548 | | |
502 | 549 | | |
503 | 550 | | |
504 | 551 | | |
505 | 552 | | |
| 553 | + | |
506 | 554 | | |
507 | 555 | | |
508 | 556 | | |
| |||
581 | 629 | | |
582 | 630 | | |
583 | 631 | | |
584 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
585 | 635 | | |
586 | 636 | | |
587 | 637 | | |
588 | 638 | | |
589 | 639 | | |
590 | 640 | | |
591 | | - | |
| 641 | + | |
| 642 | + | |
592 | 643 | | |
593 | 644 | | |
594 | 645 | | |
| |||
607 | 658 | | |
608 | 659 | | |
609 | 660 | | |
610 | | - | |
| 661 | + | |
611 | 662 | | |
612 | 663 | | |
613 | 664 | | |
| |||
624 | 675 | | |
625 | 676 | | |
626 | 677 | | |
627 | | - | |
| 678 | + | |
628 | 679 | | |
629 | 680 | | |
630 | 681 | | |
| |||
636 | 687 | | |
637 | 688 | | |
638 | 689 | | |
639 | | - | |
| 690 | + | |
640 | 691 | | |
641 | 692 | | |
642 | 693 | | |
| |||
655 | 706 | | |
656 | 707 | | |
657 | 708 | | |
658 | | - | |
| 709 | + | |
659 | 710 | | |
660 | 711 | | |
661 | 712 | | |
| |||
792 | 843 | | |
793 | 844 | | |
794 | 845 | | |
795 | | - | |
| 846 | + | |
796 | 847 | | |
797 | 848 | | |
798 | 849 | | |
| |||
805 | 856 | | |
806 | 857 | | |
807 | 858 | | |
808 | | - | |
| 859 | + | |
809 | 860 | | |
810 | 861 | | |
811 | 862 | | |
812 | 863 | | |
813 | 864 | | |
814 | | - | |
| 865 | + | |
815 | 866 | | |
816 | 867 | | |
817 | 868 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5632 | 5632 | | |
5633 | 5633 | | |
5634 | 5634 | | |
5635 | | - | |
5636 | | - | |
5637 | | - | |
5638 | | - | |
5639 | | - | |
5640 | | - | |
5641 | | - | |
| 5635 | + | |
| 5636 | + | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
5642 | 5640 | | |
5643 | 5641 | | |
5644 | 5642 | | |
| |||
5654 | 5652 | | |
5655 | 5653 | | |
5656 | 5654 | | |
5657 | | - | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
5658 | 5661 | | |
5659 | 5662 | | |
5660 | | - | |
| 5663 | + | |
5661 | 5664 | | |
5662 | 5665 | | |
5663 | | - | |
| 5666 | + | |
| 5667 | + | |
5664 | 5668 | | |
5665 | 5669 | | |
5666 | 5670 | | |
| |||
5705 | 5709 | | |
5706 | 5710 | | |
5707 | 5711 | | |
5708 | | - | |
| 5712 | + | |
5709 | 5713 | | |
5710 | 5714 | | |
5711 | 5715 | | |
5712 | 5716 | | |
5713 | 5717 | | |
5714 | 5718 | | |
5715 | 5719 | | |
5716 | | - | |
| 5720 | + | |
| 5721 | + | |
5717 | 5722 | | |
5718 | 5723 | | |
5719 | 5724 | | |
| |||
5723 | 5728 | | |
5724 | 5729 | | |
5725 | 5730 | | |
5726 | | - | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
5727 | 5737 | | |
5728 | 5738 | | |
5729 | 5739 | | |
5730 | 5740 | | |
5731 | 5741 | | |
5732 | | - | |
5733 | | - | |
| 5742 | + | |
| 5743 | + | |
5734 | 5744 | | |
5735 | | - | |
5736 | | - | |
| 5745 | + | |
| 5746 | + | |
5737 | 5747 | | |
5738 | 5748 | | |
5739 | 5749 | | |
| |||
0 commit comments