git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: "Stephen R. van den Berg" <srb@cuci.nl>
Cc: Chris Frey <cdfrey@foursquare.net>,
	jidanni@jidanni.org, dhruvakm@gmail.com, git@vger.kernel.org
Subject: Re: timestamps not git-cloned
Date: Sat, 29 Nov 2008 11:16:58 +0100	[thread overview]
Message-ID: <200811291117.01655.trast@student.ethz.ch> (raw)
In-Reply-To: <20081129092231.GA32630@cuci.nl>

[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]

Stephen R. van den Berg wrote:
> Chris Frey wrote:
> >If this is the important bit, perhaps git-archive could be changed
> >to create tarballs with file timestamps based on their commit dates.
> 
> Based on the principle of least surprise, I'd consider this a rather good
> idea.

Unless I'm missing something, this would make git-archive rather more
expensive than it is now: Tree objects do not record any timestamps,
so figuring out the last commit that changed a file requires a full
history walk in the worst case[*].  (This is another side-effect of
not versioning files.)  On the other hand, current git-archive's
running time depends only on the size of the tree-ish given, including
all subtrees and blobs.

My unscientific guesstimates on how much work this would be, in a
random (old) linux-2.6 clone:

  $ git rev-parse HEAD
  e013e13bf605b9e6b702adffbe2853cfc60e7806
  $ time git ls-tree -r -t $(git rev-list HEAD~5000..HEAD) >/dev/null

  real    0m1.385s
  user    0m1.164s
  sys     0m0.220s
  $ git rev-list HEAD | wc -l
  117812

So reading (and dumping) all those trees and subtrees incurs a penalty
on the order of 30 seconds.  Compare to the current running time of
git-archive:

  $ time git archive --format=tar HEAD >/dev/null

  real    0m2.790s
  user    0m2.684s
  sys     0m0.072s

Of course, the ratio will keep getting worse as history gets longer.

- Thomas

[*] I think to really have a "worst case" here, you need at least one
file in every leaf directory that has not changed since the root
commit, and another that changes in every commit to force the search
to really read every subtree.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch




[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2008-11-29 10:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-28  2:24 timestamps not git-cloned jidanni
2008-11-28  3:08 ` dhruva
2008-11-28  5:06   ` jidanni
2008-11-28  6:59     ` Daniel Barkalow
2008-11-29  8:54     ` Chris Frey
2008-11-29  9:22       ` Stephen R. van den Berg
2008-11-29 10:16         ` Thomas Rast [this message]
2008-11-30  0:48           ` jidanni
2008-12-01  9:09             ` Andreas Ericsson
2008-12-01 11:44               ` Jakub Narebski
2008-11-30  1:14           ` Sitaram Chamarty
2008-11-28  5:57   ` David Brown
2008-11-28 14:59   ` Peter Krefting
2008-11-28 11:51 ` Johannes Schindelin
2008-11-28 12:58 ` Robin Rosenberg
2008-11-28 13:20   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200811291117.01655.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=cdfrey@foursquare.net \
    --cc=dhruvakm@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jidanni@jidanni.org \
    --cc=srb@cuci.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).