Skip to content

Extend packfile in increments of page_size.#4053

Merged
ethomson merged 1 commit intolibgit2:masterfrom
chescock:extend-packfile-by-pages
Jan 21, 2017
Merged

Extend packfile in increments of page_size.#4053
ethomson merged 1 commit intolibgit2:masterfrom
chescock:extend-packfile-by-pages

Conversation

@chescock
Copy link
Copy Markdown
Contributor

I have an application that uses LibGit2Sharp, and it's been having performance issues doing fetches. Using the profiling technique of running it in the debugger and pausing it, I discovered it was spending a lot of time calling p_write from append_to_pack to write a single byte.

I guessed that there was a cost for each call that actually extended the file, and that we could reduce the overall cost by rounding the size up so that we extend the file fewer times in larger chunks. I'm using mmap_alignment for the rounding since that was used in the nearby write_at method, but I don't know whether or not that's an appropriate value.

A local fetch of the libgit2 repository on my Windows 7 machine takes 307s without this change and 43s with it, for a 7x speedup, and the fetch goes from being I/O-bound to CPU-bound.

This improves performance by reducing the number of I/O operations.
@chescock chescock force-pushed the extend-packfile-by-pages branch from 173f3cf to c7a1535 Compare December 29, 2016 21:00
@ethomson
Copy link
Copy Markdown
Member

That's quite an improvement. Thanks, @chescock !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants