diff options
| author | Vicent Marti <tanoku@gmail.com> | 2011-07-09 02:10:46 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-07-09 02:40:16 +0200 |
| commit | afeecf4f262b74270368ef8a70c582ea9d5a18e8 (patch) | |
| tree | c078ee522e3d9f7bf01fe7e85f5baa7f41dacde4 /src/filebuf.h | |
| parent | 2fc78e700cc4684c1e5899d7a4a619da1e3e3679 (diff) | |
| download | libgit2-afeecf4f262b74270368ef8a70c582ea9d5a18e8.tar.gz | |
odb: Direct writes are back
DIRECT WRITES ARE BACK AND FASTER THAN EVER. The streaming writer to the
ODB was an overkill for the smaller objects like Commit and Tags; most
of the streaming logic was taking too long.
This commit makes Commits, Tags and Trees to be built-up in memory, and
then written to disk in 2 pushes (header + data), instead of streaming
everything.
This is *always* faster, even for big files (since the git_filebuf class
still does streaming writes when the memory cache overflows). This is
also a gazillion lines of code smaller, because we don't have to
precompute the final size of the object before starting the stream (this
was kind of defeating the point of streaming, anyway).
Blobs are still written with full streaming instead of loading them in
memory, since this is still the fastest way.
A new `git_buf` class has been added. It's missing some features, but
it'll get there.
Diffstat (limited to 'src/filebuf.h')
| -rw-r--r-- | src/filebuf.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/filebuf.h b/src/filebuf.h index 37cb36784..1567b115c 100644 --- a/src/filebuf.h +++ b/src/filebuf.h @@ -41,7 +41,7 @@ typedef struct git_filebuf git_filebuf; int git_filebuf_write(git_filebuf *lock, const void *buff, size_t len); int git_filebuf_reserve(git_filebuf *file, void **buff, size_t len); -int git_filebuf_printf(git_filebuf *file, const char *format, ...); +int git_filebuf_printf(git_filebuf *file, const char *format, ...) GIT_FORMAT_PRINTF(2, 3); int git_filebuf_open(git_filebuf *lock, const char *path, int flags); int git_filebuf_commit(git_filebuf *lock); |
