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

Re: [PATCH 4/4] Invalidate cache-tree entries for touched paths in git-apply.

From
Junio C Hamano <junkio@cox.net>
Date
Apr 24, 2006, 01:25 UTC
Message-ID
<7vodyrdas9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7v3bg3etnv.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
Show 8 quoted lines
>  * ... then the big rock falls.  With this, I tried to apply and
>    then write-tree "diff-tree -p $commit^1 $commit" on top of
>    "$commit^1" for the last 20 or so commits in the kernel tree.
>    The "master" version takes 0.15 second per patch on my Duron
>    750 with 700MB, while this one does that in 0.06 second.
>    This also helps the memory pressure because we do not have to
>    regenerate unchanged trees.  810 minor faults with the patch
>    vs 2150 minor faults without.

Sorry, but not really. The patch is wrong and the measurement was flawed.

It was doing unnecessarily more work in git-apply, which made git-write-tree a no-op, and I was measuring only git-write-tree.

The following goes on top of the series to remove that unnecessary work from git-apply. Unfortunately this makes the overall combination a bit slower than before X-<.

But I have not optimized cache-tree.c for speed; for example, its subtree lists are not even sorted. Once that is done we may get decent speedups from the combo.

---
diff --git a/apply.c b/apply.c
index 5fa2c1e..e283df3 100644
--- a/apply.c
+++ b/apply.c
@@ -1935,8 +1935,6 @@ static int apply_patch(int fd, const cha
 				  active_cache_sha1) ||
 		    commit_index_file(&cache_file))
 			die("Unable to write new cachefile");
-		cache_tree_update(active_cache_tree,
-				  active_cache, active_nr, 1);
 		write_cache_tree(active_cache_sha1, active_cache_tree);
 	}
 
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 8 in “Invalidate cache-tree entries for touched paths in git-apply.”
  1. 4/4 Invalidate cache-tree entries for touched paths in git-apply.Junio C Hamano, Apr 23, 2006
  2. Junio C HamanoApr 24, 2006
  3. Junio C HamanoApr 24, 2006
  4. 5/4 Minimum fixups to cache-treeJunio C Hamano, Apr 24, 2006
  5. 50% speed-up of "git-apply && git-write-tree" sequence.Junio C Hamano, Apr 24, 2006
  6. maintenance of cache-tree dataJunio C Hamano, Apr 24, 2006
  7. Junio C HamanoApr 24, 2006
  8. Junio C HamanoApr 25, 2006

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.