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

Re: [PATCH 3/4] pack-objects: don't traverse objects unnecessarily

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 27, 2011, 22:26 UTC
Message-ID
<7vk47qxe9x.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1318915284-6361-3-git-send-email-dpmcgee@gmail.com>
Dan McGee <dpmcgee@gmail.com> writes:
> Two optimizations take place here- we can start our objects array
> iteration from a known point where we left off before we started trying
> to find our tags,

This I would understand (but I am somewhat curious how much last_untagged would advance relative to nr_objects for this half of the optimization to be worth it), but...

> and we don't need to do the deep dives required by
> add_family_to_write_order() if the object has already been marked as
> filled.

I am not sure if this produces the identical result that was benchmarked in the original series.

For example, if you have a tagged object that is not a commit (say a blob), you would have written that blob in the second phase (write tagged objects together), so the family of blobs that share same delta parent as that blob will not be written in this "Finally all the rest" in the right place in the original list, no?

I do not think this change would forget to fill an object that needs to be filled, but it would affect the resulting ordering of the list, so...

Show 13 quoted lines
> @@ -560,8 +561,13 @@ static struct object_entry **compute_write_order(void)
>  	/*
>  	 * Finally all the rest in really tight order
>  	 */
> -	for (i = 0; i < nr_objects; i++)
> -		add_family_to_write_order(wo, &wo_end, &objects[i]);
> +	for (i = last_untagged; i < nr_objects; i++) {
> +		if (!objects[i].filled)
> +			add_family_to_write_order(wo, &wo_end, &objects[i]);
> +	}
> +
> +	if(wo_end != nr_objects)
> +		die("ordered %u objects, expected %u", wo_end, nr_objects);
Previous: Dan McGeeNext: Dan McGee
Message 4 of 10 in “pack-objects: mark add_to_write_order() as inline”
  1. 1/4 pack-objects: mark add_to_write_order() as inlineDan McGee, Oct 18, 2011
  2. 2/4 pack-objects: use unsigned int for counter and offset valuesDan McGee, Oct 18, 2011
  3. 3/4 pack-objects: don't traverse objects unnecessarilyDan McGee, Oct 18, 2011
  4. Junio C HamanoOct 27, 2011
  5. Dan McGeeNov 9, 2011
  6. Junio C HamanoNov 12, 2011
  7. Dan McGeeNov 13, 2011
  8. Junio C HamanoNov 14, 2011
  9. 4/4 pack-objects: rewrite add_descendants_to_write_order() iterativelyDan McGee, Oct 18, 2011
  10. Junio C HamanoOct 27, 2011

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.