git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[GSoC Patch v3 0/4] Move generation, graph_pos to a slab

From
Abhishek Kumar <abhishekkumar8222@gmail.com>
Date
Jun 12, 2020, 18:40 UTC
Message-ID
<20200612184014.1226972-1-abhishekkumar8222@gmail.com>

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 number v2, which uses 64-bit generation number instead of current 32-bits.

While the overall test suite runs slightly faster than master (series: 27m10s, master: 27ms34s, faster by 2.35%), certain commands like `git merge-base --is-ancestory` are slowed by nearly 40% as discovered by SDEZER Gabor [1].

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 on that in a later series.

I did not mention maximum RSS in the commit messages as they were nearly identical (series: 68104kb, master: 68040kb, fewer by <0.1%). This leads me to conclude that either the test using maximum memory involves commit graph or did not involve the struct commit at all. The move to commit-slab reduces memory footprint for the cases where struct commit is used but members generation and graph position are not. Average RSS would have been a good and more representative measure, but unfortunately time(1) could not measure it on my system.

With this, I feel the patch will require minor fixes, if any. I am moving ahead with working the next step of "Implement Generation Number v2" that is proper handling of commit-graph format change.

Based on the discussions, I feel we should compute both generation number v1 and the date offset value with storing date offsets in a new chunk as the cost is mostly from walking the commits.

Abhishek Kumar (4):
  alloc: introduce parsed_commits_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                         |   6 +-
 blame.c                         |   2 +-
 bloom.c                         |   7 +-
 commit-graph.c                  | 122 ++++++++++++++++++++++++--------
 commit-graph.h                  |  10 +++
 commit-reach.c                  |  69 +++++++++++-------
 commit.c                        |   8 ++-
 contrib/coccinelle/commit.cocci |  18 +++++
 revision.c                      |  20 +++---
 9 files changed, 188 insertions(+), 74 deletions(-)
-- 
2.27.0

Changes in v3:
- Introduce alloc commit to fix the failing diff-submodule test.
- Elaborate on performance and slow down noticed in the 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_ZERO) from commit.h to commit-graph.h

CI Build: https://travis-ci.com/github/abhishekkumar2718/git  
Next: Abhishek Kumar
Message 1 of 14 in “Move generation, graph_pos to a slab”
  1. 0/4 Move generation, graph_pos to a slabAbhishek Kumar, Jun 12, 2020
  2. 1/4 alloc: introduce parsed_commits_countAbhishek Kumar, Jun 12, 2020
  3. Junio C HamanoJun 12, 2020
  4. Junio C HamanoJun 12, 2020
  5. Junio C HamanoJun 12, 2020
  6. Junio C HamanoJun 12, 2020
  7. Abhishek KumarJun 13, 2020
  8. Jakub NarębskiJun 12, 2020
  9. 2/4 commit-graph: introduce commit_graph_data_slabAbhishek Kumar, Jun 12, 2020
  10. SZEDER GáborJun 13, 2020
  11. Abhishek KumarJun 17, 2020
  12. 3/4 commit: move members graph_pos, generation to a slabAbhishek Kumar, Jun 12, 2020
  13. 4/4 commit-graph: minimize commit_graph_data_slab accessAbhishek Kumar, Jun 12, 2020
  14. Jakub NarębskiJun 12, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.