diff options
author | Abhishek Kumar <abhishekkumar8222@gmail.com> | 2020-06-17 14:44:11 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-06-17 14:37:52 -0700 |
commit | c752ad09c4ea479e8d54d08637cc0e5709723208 (patch) | |
tree | af0f1faa8d6e5149dec7d008a1370483c09ca151 /bloom.c | |
parent | c49c82aa4c1036ba1629f73223cff53230e695f3 (diff) | |
download | git-c752ad09c4ea479e8d54d08637cc0e5709723208.tar.gz |
commit-graph: minimize commit_graph_data_slab access
In an earlier patch, multiple struct acccesses to `graph_pos` and
`generation` were auto-converted to multiple method calls.
Since the values are fixed and commit-slab access costly, we would be
better off with storing the values as a local variable and reusing it.
Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bloom.c')
-rw-r--r-- | bloom.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -33,15 +33,16 @@ static int load_bloom_filter_from_graph(struct commit_graph *g, struct commit *c) { uint32_t lex_pos, start_index, end_index; + uint32_t graph_pos = commit_graph_position(c); - while (commit_graph_position(c) < g->num_commits_in_base) + while (graph_pos < g->num_commits_in_base) g = g->base_graph; /* The commit graph commit 'c' lives in doesn't carry bloom filters. */ if (!g->chunk_bloom_indexes) return 0; - lex_pos = commit_graph_position(c) - g->num_commits_in_base; + lex_pos = graph_pos - g->num_commits_in_base; end_index = get_be32(g->chunk_bloom_indexes + 4 * lex_pos); |