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

Re: [PATCH v3 1/4] alloc: introduce parsed_commits_count

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 12, 2020, 22:52 UTC
Message-ID
<xmqq8sgr28yd.fsf@gitster.c.googlers.com>
In-Reply-To
<20200612184014.1226972-2-abhishekkumar8222@gmail.com>
Abhishek Kumar <abhishekkumar8222@gmail.com> writes:
Show 7 quoted lines
>  static unsigned int alloc_commit_index(struct repository *r)
>  {
> -	return r->parsed_objects->commit_count++;
> +	static unsigned int parsed_commits_count = 0;
> +	r->parsed_objects->commit_count++;
> +	return parsed_commits_count++;
>  }

I'll queue this as-is, together with the rest of the series, but with the following SQUASH??? to document why we are counting globally.

I do not think r->parsed_objects->*_count is used by anybody, and we probably can eventually get rid of these stats fields, and when that happens, we may want to lose the "struct repository *" pointer from the functions in the callchain, but not right now.

Thanks.
 alloc.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/alloc.c b/alloc.c
index 29f0e3aa80..ee92661b71 100644
--- a/alloc.c
+++ b/alloc.c
@@ -99,6 +99,11 @@ void *alloc_object_node(struct repository *r)
 	return obj;
 }
 
+/*
+ * The returned count is to be used as an index into commit slabs,
+ * that are *NOT* maintained per repository, and that is why a single
+ * global counter is used.
+ */
 static unsigned int alloc_commit_index(struct repository *r)
 {
 	static unsigned int parsed_commits_count = 0;
-- 
2.27.0-90-geebb51ba8c
Previous: Junio C HamanoNext: Abhishek Kumar
Message 6 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.