Re: [RFC/PATCH] shortstatus v1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 10, 2009 at 03:05:57PM -0800, Junio C Hamano wrote:

> There is an obvious optimization you can do to "diff-index --cached" using
> cache-tree.  If your index is really clean, computing the tree object the
> index would represent (without writing the tree object out) and comparing
> it against HEAD^{tree} may be a tad faster.

Clever, but I think you may just be trading one scenario for "worst
case" versus another (i.e., now when you _do_ have a difference to do an
early return, you still have to touch everything in the cache).

Just for fun, I timed a quick and dirty implementation. It looks like
generating the tree actually ends up taking just a little bit longer,
even with an unchanged index (which should be the case it speeds up).

But maybe I just did it wrong. My implementation was basically just:

  t = cache_tree();
  if (!cache_tree_fully_valid(t))
    cache_tree_update(t, active_cache, active_nr, 0, 0);
  get_sha1("HEAD", sha1);
  return hashcmp(t->sha1, sha1);

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux