unpack-trees: fix accidentally quadratic behavior
commita6720955f19ea10bf9569d04480deed25b1bccf7
authorDavid Turner <dturner@twopensource.com>
Fri, 22 Jan 2016 19:58:43 +0000 (22 14:58 -0500)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2016 21:03:10 +0000 (22 13:03 -0800)
treea1278d3dd1d02f69605e3d123cca6929fa9462a5
parentd9c2bd560e1e7a3d4654fb6ef3f9037ad337eb01
unpack-trees: fix accidentally quadratic behavior

While unpacking trees (e.g. during git checkout), when we hit a cache
entry that's past and outside our path, we cut off iteration.

This provides about a 45% speedup on git checkout between master and
master^20000 on Twitter's monorepo.  Speedup in general will depend on
repostitory structure, number of changes, and packfile packing
decisions.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c