Re: [PATCH] git-svn: Make it scream by minimizing temp files
- From
- Eric Wong <normalperson@yhbt.net>
- Date
- Aug 10, 2008, 01:46 UTC
- Message-ID
- <20080810014625.GA31438@hand.yhbt.net>
- In-Reply-To
- <489DBB8A.2060207@griep.us>
Marcus Griep <marcus@griep.us> wrote:
Show 11 quoted lines
> Eric Wong wrote:
> > Perhaps a sysseek in addition to the seek above would help
> > with the problems you mentioned in the other email.
> >
> > sysseek $TEMP_FILES{$fd}, 0, 0 or croak $!;
> >
> > (It doesn't seem to affect me when running the test suite, though).
>
> Sounds like a good idea, but I found the source of my cygwin issue,
> namely that /tmp (which perl uses for its temp files) was mounted
> in textmode. I fixed that by remounting that folder in binmode.Hmm.. Instead of relying on users on weird platforms to change their mount options, git-svn should also set binmode on all filehandles regardless. Will that get around the problem you had with cygwin?
git-svn already sets binmode for all the rev_map files.
Show 13 quoted lines
> Nonetheless, if consumers may use sysread, after getting the file handle
> then we'll want to use sysseek.
>
> >> + } else {
> >> + $TEMP_FILES{$fd} = File::Temp->new(
> >> + TEMPLATE => 'GitSvn_XXXXXX',
> >> + DIR => File::Spec->tmpdir
> >> + ) or croak $!;
> >
> > Way too much indentation :x
>
> That's what I get for assuming a tab width of 4. I'll redo it with
> about half as many tabs.Tabwidth is 8 characters by default, and that is what git uses.
Show 13 quoted lines
> > Also, this seems generic enough that other programs (git-cvsimport > > perhaps) can probably use it, too. So maybe it could go into Git.pm or > > a new module, Git/Tempfile.pm? > > I'd advocate the latter since it's not really Git functionality, but > rather a support, so a submodule would perhaps be the better placement. > > Also, I came up with one more optimization inside 'sub close_file', so > I'll roll that in too. Tell me where you/the community would prefer > the tempfile functionality, and I'll submit a new patch series with > one patch for the module and one patch for git-svn. > > By then, I should have some better benchmark results.
Junio (or anybody else), any thoughts on what the submodule should be named? I'm not good at naming things :x
-- Eric Wong