diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2016-04-27 12:00:31 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2016-05-02 17:37:26 +0200 |
commit | a97b769a0ef7fe8b301c07280c9b80233bb77643 (patch) | |
tree | b7689ab05499e22ca4b9787f12a30a437b7e9547 /src/delta-apply.h | |
parent | 88284dfb7905c5990babb4238b7cd30bdf823500 (diff) | |
download | libgit2-cmn/faster-header.tar.gz |
odb: avoid inflating the full delta to read the headercmn/faster-header
When we read the header, we want to know the size and type of the
object. We're currently inflating the full delta in order to read the
first few bytes. This can mean hundreds of kB needlessly inflated for
large objects.
Instead use a packfile stream to read just enough so we can read the two
varints in the header and avoid inflating most of the delta.
Diffstat (limited to 'src/delta-apply.h')
-rw-r--r-- | src/delta-apply.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/delta-apply.h b/src/delta-apply.h index d7d99d04c..eeeb78682 100644 --- a/src/delta-apply.h +++ b/src/delta-apply.h @@ -8,6 +8,7 @@ #define INCLUDE_delta_apply_h__ #include "odb.h" +#include "pack.h" /** * Apply a git binary delta to recover the original content. @@ -47,4 +48,15 @@ extern int git__delta_read_header( size_t *base_sz, size_t *res_sz); +/** + * Read the header of a git binary delta + * + * This variant reads just enough from the packfile stream to read the + * delta header. + */ +extern int git__delta_read_header_fromstream( + size_t *base_sz, + size_t *res_sz, + git_packfile_stream *stream); + #endif |