| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of using a map for offset indexing, use a sorted slice.
Binary searching is fast, and a slice is much more compact.
This has a negligible hit on speed, but has a significant impact on
memory usage, especially for larger repos.
benchmark old ns/op new ns/op delta
BenchmarkIndexConstruction-12 15506506 14056098 -9.35%
benchmark old allocs new allocs delta
BenchmarkIndexConstruction-12 60764 60385 -0.62%
benchmark old bytes new bytes delta
BenchmarkIndexConstruction-12 4318145 3913169 -9.38%
Signed-off-by: David Symonds <dsymonds@golang.org>
|
|
|
|
|
|
|
|
| |
Previously some close errors were losts. This is specially problematic
in go-git as lots of work is done here like generating indexes and
moving packfiles.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
| |
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In some cases the original data is not saved before it is cleaned
and forces a panic when it's needed.
The change adds ObjectToPack.CleanOriginal to be used to clean original
object instead of:
object.Original = nil
Now when the Original data is freed because it's no longer in the pack
window a SetOriginal call is done to make sure that Size, Hash and Size
data is not lost.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
|
|
|
| |
SetOriginal now skips setting resolved values if the provided
object is nil. BackToOriginal also skips nil Original objects.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Resolving cycles relied on ObjectToPack objects having Original. This
is no longer true with the changes from #720. This commit changes:
* Save original type, hash and size in ObjectToPack
* Use SetObject to set both Original and resolved type, hash and size
* Restore original object before using BackToOriginal (cycle resolution)
* Update encoder test to check this case
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
| |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
crc update with block smaller than 16 bytes uses a slower version of the
function. ReadByte is heavily used by zlib inflate so most of the time
crc is update byte by byte.
A new Flush method is added to the scanner to flush this crc writer
cache. It is only called when the Scanner reader is a teeReader.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
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 <jfontan@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Object walk reconstructs delta objects but these are not cleaned up
after they got out the pack window. Without this change all
reconstructed objects reside in memory.
restoreOriginal call is moved before calling Size(). Now we can not
guarantee that the object is already undeltified.
Signed-off-by: Javi Fontan <javier@sourced.tech>
|
|\
| |
| | |
plumbing: cache, enforce the use of cache in packfile decoder
|
| |
| |
| |
| | |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Decoder object can make use of an object cache to speed up processing.
Previously the only way to specify it was changing manually the struct
generated by NewDecodeForFile. This lead to some instances to be created
without it and penalized performance.
Now the cache should be explicitly passed to the constructor function.
NewDecoder now creates objects with a cache using the default size.
A new helper function was added to create cache objects with the default
size as this becomes a common task now:
cache.NewObjectLRUDefault()
Signed-off-by: Javi Fontan <jfontan@gmail.com>
|
|/
|
|
|
|
|
|
|
|
|
| |
- Remove wrong 'if' on delta selector that causes poor delta reutilizations
- packfile.Encoder now can write deltas and objects in a non specific order
- ObjectToPack now saves the Offset on the packfile to be able to obtain base
offset in a recursive manner and write them before the delta itself
- Added encoder test to check cyclic delta chains
- Check the output packfile hash in all encoder tests
Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- no length for map initialization
- don't check for boolean/error return
- don't format string
- use string method of bytes buffer instead of converting bytes to
string
- use `strings.Contains` instead of `strings.Index`
- use `bytes.Equal` instead of `bytes.Compare`
|
|
|
|
| |
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
|
|
|
|
| |
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
|
|\
| |
| | |
packfile: use buffer pool for diffs
|
| | |
|
|/
|
|
| |
This helps keep memory usage stable while calculating deltas.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One use of go-git is to transfer git data from a non-standard git repo
(not stored in a file system, for example) to a "remote" backed by a
standard, local .git repo.
In this scenario, delta compression is not needed to reduce transfer
time over the "network", because there is no network. The underlying
storage layer has already taken care of the data tranfer, and sending
the objects to local .git storage doesn't require compression. So this
PR gives the user the option to turn off compression when it isn't
needed.
Of course, this results in a larger, uncompressed local .git repo, but
the user can then run git gc or git repack on that repo if they care
about the storage costs.
Turning the pack window to 0 on reduces total push time of a 36K repo
by 50 seconds (out of a pre-PR total of 3m26s).
|
|
|
|
| |
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
|
|
|
|
| |
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
|
|
|
|
| |
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
|
|
|
|
| |
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
|
|
|
|
| |
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
|
|
|
|
| |
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
|
|
|
|
|
|
|
|
|
|
| |
This sets a default sliding window of 10 for the delta calculation,
just like git CL:
https://git-scm.com/docs/git-pack-objects#git-pack-objects---windowltngt
For a big-ish repo with 35K objects (17K commits), this reduced the
time for calling `deltaSelection.walk` during a push from more than 14
minutes to about a minute.
|
|
|
|
|
| |
ObjectType.IsDelta is a convenience function to match both
offset and reference delta types.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* plumbing: add DeltaObject interface for EncodedObjects that
are deltas and hold additional information about them, such
as the hash of the base object.
* plumbing/storer: add DeltaObjectStorer interface for object
storers that can return DeltaObject. Note that calls to
EncodedObject will never return instances of DeltaObject.
That requires explicit calls to DeltaObject.
* storage/filesystem: implement DeltaObjectStorer interface.
* plumbing/packfile: packfile encoder now supports reusing
deltas that are already computed (e.g. from an existing
packfile) if the storage implements DeltaObjectStorer.
Reusing deltas boosts performance of packfile generation
(e.g. on push).
|
|
|
|
|
|
|
| |
* Improve checks for encode/decode.
* Make it easier to extend this test with more
storage backends.
|
|
|
|
|
| |
Reuse delta base object cache for packfile decoders
across multiple instances.
|
|
|
|
|
|
| |
* renamed Add to Put
* Get returns a second bool value to indicate if there
was hit or miss.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was an internal type (i.e. storage/filesystem.idx) to
use as in-memory index for packfiles. This was not convenient
to reuse in the packfile.
This commit creates a new representation (format/packfile.Index)
that can be converted to and from idxfile.Idxfile.
A packfile.Index now contains the functionality that was scattered
on storage/filesystem.idx and packfile.Decoder's internals.
storage/filesystem now reuses packfile.Index instances and this
also results in higher cache hit ratios when resolving deltas.
|
|\
| |
| | |
*: add more IO error checks
|
| | |
|
| | |
|
|/ |
|
| |
|
|
|
|
| |
More info here: https://github.com/git/git/blob/f7466e94375b3be27f229c78873f0acf8301c0a5/diff-delta.c#L428
|
|
|
|
| |
Implemented algorithm described in "File System Support for Delta Compression" paper, from "Joshua P. MacDonald".
|
| |
|
|
|
|
|
|
| |
This has signature and behavior distinct from io.Seeker,
go vet complains about this, so we change it to a different name
to avoid confusion.
|
| |
|
|
|
|
| |
To be able to fix #261 we will move again to gopkg.in before v4 stable release.
|
| |
|
|
|
|
| |
Because cache package is only intended to be used at internal level, we move it to the plumbing package.
|