Commit 96c4f4a
commit: allow associating auxiliary info on-demand
The "indegree" field in the commit object is only used while sorting
a list of commits in topological order, and wasting memory otherwise.
We would prefer to shrink the size of individual commit objects,
which we may have to hold thousands of in-core. We could eject
"indegree" field out from the commit object and represent it as a
dynamic table based on the decoration infrastructure, but the
decoration is meant for sparse annotation and is not a good match.
Instead, let's try a different approach.
- Assign an integer (commit->index) to each commit we keep in-core
(reuse the space of "indegree" field for it);
- When running the topological sort, allocate an array of integers
in bulk (called "slab"), use the commit->index as an index into
this array, and store the "indegree" information there.
This does _not_ reduce the memory footprint of a commit object, but
the commit->index can be used as the index to dynamically associate
commits with other kinds of information as needed.
Signed-off-by: Junio C Hamano <[email protected]>1 parent a46221e commit 96c4f4a
2 files changed
+51
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| |||
497 | 501 | | |
498 | 502 | | |
499 | 503 | | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
500 | 534 | | |
501 | 535 | | |
502 | 536 | | |
| |||
505 | 539 | | |
506 | 540 | | |
507 | 541 | | |
| 542 | + | |
508 | 543 | | |
509 | 544 | | |
510 | 545 | | |
511 | 546 | | |
512 | 547 | | |
| 548 | + | |
| 549 | + | |
513 | 550 | | |
514 | 551 | | |
515 | 552 | | |
516 | | - | |
| 553 | + | |
517 | 554 | | |
518 | 555 | | |
519 | 556 | | |
520 | 557 | | |
521 | 558 | | |
522 | 559 | | |
523 | 560 | | |
| 561 | + | |
524 | 562 | | |
525 | | - | |
526 | | - | |
| 563 | + | |
| 564 | + | |
527 | 565 | | |
528 | 566 | | |
529 | 567 | | |
| |||
540 | 578 | | |
541 | 579 | | |
542 | 580 | | |
543 | | - | |
| 581 | + | |
544 | 582 | | |
545 | 583 | | |
546 | 584 | | |
| |||
561 | 599 | | |
562 | 600 | | |
563 | 601 | | |
| 602 | + | |
564 | 603 | | |
565 | | - | |
| 604 | + | |
566 | 605 | | |
567 | 606 | | |
568 | 607 | | |
569 | 608 | | |
570 | 609 | | |
571 | 610 | | |
572 | 611 | | |
573 | | - | |
| 612 | + | |
574 | 613 | | |
575 | 614 | | |
576 | 615 | | |
| |||
581 | 620 | | |
582 | 621 | | |
583 | 622 | | |
584 | | - | |
| 623 | + | |
585 | 624 | | |
586 | 625 | | |
587 | 626 | | |
| 627 | + | |
| 628 | + | |
588 | 629 | | |
589 | 630 | | |
590 | 631 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments