Re: [PATCH 2/2] Implement a simple delta_base cache
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Mar 18, 2007, 01:29 UTC
- Message-ID
- <Pine.LNX.4.64.0703171822280.4964@woody.linux-foundation.org>
- In-Reply-To
- <118833cc0703171814n4e56ab9fwfaaea81c903ae235@mail.gmail.com>
On Sat, 17 Mar 2007, Morten Welinder wrote:
Show 7 quoted lines
> > > samples % app name symbol name > > 41527 15.6550 git strlen > > Almost 16% in strlen? Ugh! > > That's a lot of strings, or perhaps very long strings. Or a profiling bug.
It's likely real, and the problem is likely lots of small strings.
Each git tree entry is:
"<octal mode> name\0" <20-byte sha1>
so you do have a *lot* of strlen() calls when doing any tree parsing. And for some inexplicable reason, glibc thinks strings are long on average, so it has a fancy algorithm to do 8 bytes at a time and tries to do things aligned etc.
The size of strlen() on x86-64 with glibc is 232 bytes. I'm not kidding.
Linus