From: Linus Torvalds <torvalds@linux-foundation.org>
To: Nicolas Pitre <nico@cam.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Git Mailing List <git@vger.kernel.org>, Chris Lee <clee@kde.org>
Subject: Re: kde.git is now online
Date: Thu, 5 Apr 2007 18:24:12 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0704051730460.6730@woody.linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.0.98.0704051703140.28181@xanadu.home>
On Thu, 5 Apr 2007, Nicolas Pitre wrote:
>
> Well.... still it certainly can be helped a bit. I wouldn't mind it
> spending half an hour of CPU if it needs to. But I just interrupted it
> with ^C with the following result so far:
>
> real 75m44.374s
> user 2m5.318s
> sys 0m54.059s
Well, the thing is, this is "normal", and doesn't really have a lot to do
with git.
If the actual working set is larger than available memory, ~5% CPU time is
actually pretty good.
The only way to improve on it is to try to make the working set smaller.
Sadly, that's often a really difficult thing to do ;(
> > I suspect you'll find that with 1GB or RAM you'll have other
> > performance problems that are more pressing ("git clone" comes to mind
> > ;)
>
> Well... same issue actually. git-pack-objects spent about 40 secs
> firmly at 100% CPU usage counting objects.
>
> Then it got stuck on:
>
> remote: Done counting 4111366 objects.
>
> again spending 3% CPU and the rest waiting for IO with the disk
> definitely trashing.
Well, I seriously doubt it's the "same issue" except in the sense that
yes, if you work with all objects, you are going to have a big working
set.
Note that "working set" is different from "memory footprint". If you have
good locality, the working set can be a *lot* smaller than the memory
footprint, and that tends to be the best/only way to improve the working
set: trying to not jump back-and-forth between different things.
One example of that kind of shrinkage of the working set was Junios commit
57584d9eddc3482c5db0308203b9df50dc62109c to "git blame": by comparing the
*pointers* rather than what they pointed to, you avoid having to follow
the pointer all the way down.
However, doing that in general tends to be very difficult. We use hashes
extensively (not just the obvious SHA1 hashes, but the object lookup
itself is based on hash tables etc), and while they are nice and fast O(1)
when you have enough memory, they do tend to spread things out so that you
are using your memory potentially very sparsely, which is the last thing
you want to do if you are paging.
Side note: I finally got the thing downloaded, and so I did a
git checkout -f
and the trace is pretty horrid. It looks something like this:
...
lstat("kdeaccessibility/IconThemes/mono/scalable/apps/kimagemapeditor.svgz", 0x7fff6f8d29f0) = -1 ENOENT (No such file or directory)
mkdir("kdeaccessibility", 0777) = -1 EEXIST (File exists)
unlink("kdeaccessibility") = -1 EISDIR (Is a directory)
stat("kdeaccessibility", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
mkdir("kdeaccessibility/IconThemes", 0777) = -1 EEXIST (File exists)
unlink("kdeaccessibility/IconThemes") = -1 EISDIR (Is a directory)
stat("kdeaccessibility/IconThemes", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
mkdir("kdeaccessibility/IconThemes/mono", 0777) = -1 EEXIST (File exists)
unlink("kdeaccessibility/IconThemes/mono") = -1 EISDIR (Is a directory)
stat("kdeaccessibility/IconThemes/mono", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
mkdir("kdeaccessibility/IconThemes/mono/scalable", 0777) = -1 EEXIST (File exists)
unlink("kdeaccessibility/IconThemes/mono/scalable") = -1 EISDIR (Is a directory)
stat("kdeaccessibility/IconThemes/mono/scalable", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
mkdir("kdeaccessibility/IconThemes/mono/scalable/apps", 0777) = -1 EEXIST (File exists)
unlink("kdeaccessibility/IconThemes/mono/scalable/apps") = -1 EISDIR (Is a directory)
stat("kdeaccessibility/IconThemes/mono/scalable/apps", {st_mode=S_IFDIR|0775, st_size=12288, ...}) = 0
open("kdeaccessibility/IconThemes/mono/scalable/apps/kimagemapeditor.svgz", O_WRONLY|O_CREAT|O_EXCL, 0666) = 5
write(5, "\37\213\10\10\205\3\263A\0\3kimagemapeditor.svg\0\344Z"..., 10112) = 10112
close(5) = 0
lstat("kdeaccessibility/IconThemes/mono/scalable/apps/kimagemapeditor.svgz", {st_mode=S_IFREG|0664, st_size=10112, ...}) = 0
...
and that repeats for every single file. There's 233,902 of them. Oops.
On the other hand, we do certain things pretty well. A "git diff", with
enough memory, takes 0.65s. That's just over *half*a*second* for 233
*thousand* files. I'd want to have tons of memory to work with this
repository, but if I did, I'd still think git is the best thing since
sliced bread.
And doing ops like "git blame" on some random file I looked at was
actually instantaneous. I probably happened to pick a new file just by
luck, but still.. Most things definitely work pretty damn well.
(Update: I did a
git log --raw -r |
grep '^:100644.*M' |
cut -f2 |
sort |
uniq -c |
sort -n
to see the file that was updated the most, to get some kind of
worst-case for "git blame". The list looks like:
...
1091 koffice/kword/kwview.cc
1099 kdelibs/khtml/khtml_part.cpp
1116 koffice/kpresenter/kpresenter_view.cc
1171 kdevelop/ChangeLog
1667 kde-common/accounts
and while "git blame" is slow on them, it's not *painfully* so. It took
13s to get the kdevelop/ChangeLog blame, and 31s (probably because the
diffs are much more interesting) to get the kpresenter_view.cc blame.
Too slow, but still usable, and "git gui" again made it more interesting
to wait for it..
That said, the more I look at this, the more I think that this is *the*
perfect example of why you shouldn't put everything in one big
repository. Git should be able to handle it, but nobody should really
do things like that. It's just stupid.
I will think hard about submodules.
Linus
next prev parent reply other threads:[~2007-04-06 1:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-05 17:03 kde.git is now online H. Peter Anvin
2007-04-05 17:30 ` Linus Torvalds
2007-04-05 17:38 ` Nicolas Pitre
2007-04-05 19:45 ` Nicolas Pitre
2007-04-05 20:51 ` Linus Torvalds
2007-04-05 22:00 ` Nicolas Pitre
2007-04-06 1:24 ` Linus Torvalds [this message]
2007-04-05 18:03 ` Chris Lee
2007-04-05 21:26 ` Junio C Hamano
2007-04-06 11:32 ` Geert Bosch
2007-04-06 12:59 ` Nicolas Pitre
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=Pine.LNX.4.64.0704051730460.6730@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=clee@kde.org \
--cc=git@vger.kernel.org \
--cc=hpa@zytor.com \
--cc=nico@cam.org \
/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).