git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "git notes show" is orders of magnitude slower than doing it manually with ls-tree and cat-file
@ 2014-11-26  0:42 Mike Hommey
  2014-11-26  1:00 ` Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Hommey @ 2014-11-26  0:42 UTC (permalink / raw)
  To: git

Hi,

I have a note tree with a bit more than 200k notes.

$ time git notes --ref foo show $sha1 > /dev/null
real    0m0.147s
user    0m0.136s
sys     0m0.008s

That's a lot of time, especially when you have a script that does that
on a fair amount of sha1s.

Now, the interesting thing is this:

$ time git ls-tree -r refs/notes/foo $sha1 ${sha1:0:2}/${sha1:2:38} ${sha1:0:2}/${sha1:2:2}/${sha1:4:36} > /dev/null
real    0m0.006s
user    0m0.008s
sys     0m0.000s

$ time git cat-file blob $objsha1 > /dev/null
real    0m0.002s
user    0m0.000s
sys     0m0.000s

And even better:

$ wc -l /tmp/note
39 /tmp/note
$ time git ls-tree refs/notes/foo $(awk '{print $1, substr($1,1,2) "/" substr($1,3), substr($1,1,2) "/" substr($1,3,2) "/" substr($1,5)}' /tmp/note) | awk '{print $3}' | git cat-file --batch > /dev/null
real    0m0.035s
user    0m0.028s
sys     0m0.004s

Reading 39 notes with ls-tree and cat-file --batch takes less time than
using git notes show for only one of them...

(and reading all 39 of them with git notes show takes 5.5s)

Mike

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-11-26 12:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-26  0:42 "git notes show" is orders of magnitude slower than doing it manually with ls-tree and cat-file Mike Hommey
2014-11-26  1:00 ` Jeff King
2014-11-26  1:24   ` Jeff King
2014-11-26  1:34     ` Jeff King
2014-11-26  2:30       ` Mike Hommey
2014-11-26  4:49         ` Jeff King
2014-11-26  2:25     ` Mike Hommey
2014-11-26  4:46       ` Jeff King
2014-11-26 11:46         ` Johan Herland
2014-11-26 12:30           ` Mike Hommey

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).