Re: [GSoC Patch 0/3] Move generation, graph_pos to a slab
From: Derrick Stolee <hidden>
Date: 2020-06-04 14:22:31
On 6/4/2020 3:27 AM, Abhishek Kumar wrote:
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 transistion to generation number v2, which uses 64-bit generation number instead of current 32-bits.
Thanks! This is an important step, and will already improve performance in subtle ways.
The third patch ("commit: convert commit->graph_pos to a slab",
2020-06-04) is currently failing diff-submodule related tests (t4041,
t4059 and t4060) for gcc [1]. I am going to send a second version soon,
fixing that.
[1]: https://travis-ci.com/github/abhishekkumar2718/git/jobs/343441189
Abhishek Kumar (3):
commit: introduce helpers for generation slab
commit: convert commit->generation to a slab
commit: convert commit->graph_pos to a slabIf we have a commit-graph file, then we have graph_pos and generation both coming from that file. Perhaps it would be better to combine the data into a single slab that stores a "struct commit_graph_data" or something? This would change only the slab definitions, since you already do a good job of wrapping the slab access in methods.
alloc.c | 2 - blame.c | 2 +- bloom.c | 6 +- commit-graph.c | 116 +++++++++++++++++++++------- commit-graph.h | 8 ++ commit-reach.c | 50 ++++++------ commit.c | 6 +- commit.h | 6 -- contrib/coccinelle/generation.cocci | 12 +++ contrib/coccinelle/graph_pos.cocci | 12 +++ revision.c | 16 ++-- 11 files changed, 158 insertions(+), 78 deletions(-) create mode 100644 contrib/coccinelle/generation.cocci create mode 100644 contrib/coccinelle/graph_pos.cocci
I appreciate the Coccinelle scripts to help identify automatic fixes for other topics in-flight. However, I wonder if they would be better placed inside the existing commit.cocci file? Thanks, -Stolee