This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 2121 ErrZLib = NewError ("zlib reading error" )
2222)
2323
24+ // When reading small objects from packfile it is beneficial to do so at
25+ // once to exploit the buffered I/O. In many cases the objects are so small
26+ // that they were already loaded to memory when the object header was
27+ // loaded from the packfile. Wrapping in FSObject would cause this buffered
28+ // data to be thrown away and then re-read later, with the additional
29+ // seeking causing reloads from disk. Objects smaller than this threshold
30+ // are now always read into memory and stored in cache instead of being
31+ // wrapped in FSObject.
32+ const smallObjectThreshold = 16 * 1024
33+
2434// Packfile allows retrieving information from inside a packfile.
2535type Packfile struct {
2636 idxfile.Index
@@ -208,7 +218,7 @@ func (p *Packfile) objectAtOffset(offset int64) (plumbing.EncodedObject, error)
208218
209219 // If we have no filesystem, we will return a MemoryObject instead
210220 // of an FSObject.
211- if p .fs == nil || h .Length <= 16 * 1024 {
221+ if p .fs == nil || h .Length <= smallObjectThreshold {
212222 return p .getNextObject (h )
213223 }
214224
You can’t perform that action at this time.
0 commit comments