The struct commit is used in many contexts. However, members `generation` and `graph_pos` are only used for commit graph related operations and otherwise waste memory. This wastage would have been more pronounced as we transition to generation nuber v2, which uses 64-bit generation number instead of current 32-bits. While the overall test suite runs as fast as master (series: 26m48s, master: 27m34s, faster by 2.87%), certain commands like `git merge-base --is-ancestor` were slowed by 40% as discovered by Szeder Gábor [1]. After minimizing commit-slab access, the slow down persists but is closer to 20%. Derrick Stolee believes the slow down is attributable to the underlying algorithm rather than the slowness of commit-slab access [2] and we will follow-up in a later series. Abhishek Kumar (4): object: drop parsed_object_pool->commit_count commit-graph: introduce commit_graph_data_slab commit: move members graph_pos, generation to a slab commit-graph: minimize commit_graph_data_slab access alloc.c | 18 +++-- alloc.h | 2 +- blame.c | 2 +- blob.c | 2 +- bloom.c | 7 +- builtin/commit-graph.c | 2 +- builtin/fsck.c | 2 +- commit-graph.c | 130 ++++++++++++++++++++++++-------- commit-graph.h | 10 +++ commit-reach.c | 69 ++++++++++------- commit.c | 12 +-- commit.h | 2 - contrib/coccinelle/commit.cocci | 18 +++++ object.c | 4 +- object.h | 3 +- refs.c | 2 +- revision.c | 20 +++-- t/helper/test-reach.c | 2 +- tag.c | 2 +- tree.c | 2 +- 20 files changed, 217 insertions(+), 94 deletions(-) -- 2.27.0 Changes in v4: - Fix segfault while initializing commit_graph_data_slab. - Fix the "commit index should have unique values" more cleanly Changes in v3: - Introduce alloc commit to fix the failing diff-submodule test. - Elaborate on perforamnce and the slow down in commit message Changes in v2: - Introduce struct commit_graph_data - Merge `graph_pos`, `generation` slabs into a single, `commit_graph_data` slab. - Use graph position for an intermediate check for generation, saving the cost of initializing generation numbers. - Add an follow-up patch caching results of slab access in local variables. - Move coccinelle transformation to commit.coccinelle instead of creating new scripts. - Elaborate on removing default values from init_commit_node(). - Revert moving macro constants (e.g. COMMIT_NOT_FROM_GRAPH, GENERATION_NUMBER_ZERO0 from commit.h to commit-graph.h