From 5b1cde56bde4834805b14f1613e8f7fda1703bf8 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Tue, 16 Jan 2018 11:48:12 +0000 Subject: Modify cache to delete more than one item to free space The previous version could only delete the oldest used object. If the object to cache was bigger than the space freed it could not be added. Also the decoder adds bases to the cache when they are needed. This change increases the speed creating indexes 2x. Signed-off-by: Javi Fontan --- plumbing/format/packfile/decoder.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plumbing/format') diff --git a/plumbing/format/packfile/decoder.go b/plumbing/format/packfile/decoder.go index cb78701..f706e5d 100644 --- a/plumbing/format/packfile/decoder.go +++ b/plumbing/format/packfile/decoder.go @@ -407,6 +407,8 @@ func (d *Decoder) fillOFSDeltaObjectContent(obj plumbing.EncodedObject, offset i if err != nil { return 0, err } + + d.cachePut(base) } obj.SetType(base.Type()) -- cgit