Thread (55 messages) flat view 55 messages, 11 authors, 2016-06-15

Re: cleaner/better zlib sources?

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:43:00


On Sat, 17 Mar 2007, Linus Torvalds wrote:
So the cache doesn't need to be "complete". It will get good hit-rates 
even from being very simple. I think I have a very simple and cunning 
plan, I'll try it out asap.
Ok, got distracted by guests coming to look at the new puppy, so it took 
longer than it should have, but the following is a simple two-patch series 
that improves path-following by a factor of almost 2.5 for me.

The cache is *really* simple. It's just a 256-entry hashed cache of the 
last few base entries, and it brings down my test-case of

	git log drivers/usb/ > /dev/null

from 2.5s to just over 1s. I have *not* tuned or tweaked this at all, and 
maybe there are better ways to do this, but this was simple as hell and 
obviously quite effective.

It also speeds up "git blame", for all the same reasons. Before (best 
times out of a run of five):

	[torvalds@woody linux]$ time git blame drivers/char/Makefile > /dev/null
	real    0m1.585s
	user    0m1.576s
	sys     0m0.004s

after:

	[torvalds@woody linux]$ time ~/git/git blame drivers/char/Makefile > /dev/null
	real    0m0.763s
	user    0m0.644s
	sys     0m0.120s

so it's a factor of two there too (just a random file, I'm not at all 
going to guarantee that this is really consistent - it should get more 
testing etc).

The first patch just does some obvious re-factoring and setting up (no 
real code changes). The second patch just uses the new functions to 
actually add a cache.

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help