]> git.ipfire.org Git - thirdparty/git.git/commit - git-svn.perl
git-svn: Make it incrementally faster by minimizing temp files
authorMarcus Griep <marcus@griep.us>
Tue, 12 Aug 2008 16:00:53 +0000 (12:00 -0400)
committerEric Wong <normalperson@yhbt.net>
Wed, 13 Aug 2008 03:46:54 +0000 (20:46 -0700)
commit0b19138ba3e4c129770565d364df65ec25ca0a8e
tree5999b5d449d0eddd47a222739d3b66167a9181b1
parente41352b24e29eba43d00a3fd117befaef1d594bc
git-svn: Make it incrementally faster by minimizing temp files

Currently, git-svn would create a temp file on four occasions:
1. Reading a blob out of the object db
2. Creating a delta from svn
3. Hashing and writing a blob into the object db
4. Reading a blob out of the object db (in another place in code)

Any time git-svn did the above, it would dutifully create and then
delete said temp file.  Unfortunately, this means that between 2-4
temporary files are created/deleted per file 'add/modify'-ed in
svn (O(n)).  This causes significant overhead and helps the inode
counter to spin beautifully.

By its nature, git-svn is a serial beast.  Thus, reusing a temp file
does not pose significant problems.  "truncate and seek" takes much
less time than "unlink and create".  This patch centralizes the
tempfile creation and holds onto the tempfile until they are deleted
on exit.  This significantly reduces file overhead, now requiring
at most three (3) temp files per run (O(1)).

Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl