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

Re: [PATCH v2] pack-objects: trace pack bytes written

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 20, 2026, 05:41 UTC
Message-ID
<aoaTjWMSO8og_iFw@pks.im>
In-Reply-To
<c6a8cdac36d2202055d637ebcc97e484122cdcd4.1787158152.git.friel@openai.com>
On Wed, Aug 19, 2026 at 04:28:10PM -0700, friel@openai.com wrote:
Show 13 quoted lines
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index 1ec5b6f206..252530172c 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -1389,6 +1390,8 @@ static void write_pack_file(void)
>  			display_progress(progress_state, written);
>  		}
>  
> +		bytes_written += hashfile_total(f) +
> +			the_repository->hash_algo->rawsz;
>  		if (pack_to_stdout) {
>  			/*
>  			 * We never fsync when writing to stdout since we may

I guess the addition here accounts for the trailing hash written by the hashfile. If so, shouldn't we also use the algortihm that the hashfile uses in the first place via `f->algop->rawsz`?

Show 9 quoted lines
> @@ -1510,6 +1513,8 @@ static void write_pack_file(void)
>  		    written, nr_result);
>  	trace2_data_intmax("pack-objects", the_repository,
>  			   "write_pack_file/wrote", nr_result);
> +	trace2_data_intmax("pack-objects", the_repository,
> +			   "write_pack_file/wrote_bytes", bytes_written);
>  }
>  
>  static int no_try_delta(const char *path)

The "write_pack_file/wrote" event is quite awkwardly named, if you ask me, as it's not immediately obvious what exactly it's counting, and the second metric may make this even more confusing. In retrospect it would've been preferable to call this "wrote_objects" to clarify.

I don't really think we guarantee any kind of stability around those traces, so we could in theory change it here, too. But I don't feel like my argument is strong enough to really warrant such a change, so maybe we should just leave it as-is.

Thanks!
Patrick
Previous: friel@openai.comNext: Jeff King
Message 4 of 11 in “pack-objects: trace pack bytes written”
  1. pack-objects: trace pack bytes writtenfriel@openai.com, Aug 17, 2026
  2. Junio C HamanoAug 18, 2026
  3. pack-objects: trace pack bytes writtenfriel@openai.com, Aug 19, 2026
  4. Patrick SteinhardtAug 20, 2026
  5. Jeff KingAug 20, 2026
  6. Patrick SteinhardtAug 20, 2026
  7. Jeff KingAug 21, 2026
  8. Junio C HamanoAug 21, 2026
  9. Junio C HamanoAug 20, 2026
  10. Jeff KingAug 21, 2026
  11. Junio C HamanoAug 21, 2026

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.