git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcus Griep <marcus@griep.us>
To: Eric Wong <normalperson@yhbt.net>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] git-svn: Make it scream by minimizing temp files
Date: Sat, 09 Aug 2008 11:45:14 -0400	[thread overview]
Message-ID: <489DBB8A.2060207@griep.us> (raw)
In-Reply-To: <20080809062521.GA10480@untitled>

Eric Wong wrote:
> Wow.  I've considered this in the past didn't think there would be a
> significant difference (of course I'm always network I/O bound).  Which
> platform and filesystem are you using are you using for tests?
> 
> I don't notice any difference running the test suite on Linux + ext3
> here, but the test suite is not a good benchmark :)

Yeah, much of the test suite uses small repositories without much history.
Where you see the benefit is with large repositories with many files.
In such cases, even a small speedup can reduce the total import time 
significantly.

My benchmark against a large repository uses the svn we have at work, but
there is currently a planned power outage, so I'll have to wait until 
tonight to run my benchmarks there (and they'll take significant time).

Nonetheless, my tests against the smaller Boo repository showed almost no
change in user time, but a 10% reduction in system time used.  There was
also a small (1%) drop in minor page faults.  I'm confident in these
results, but won't certify them until I'm able to run the tests on a much
larger repository.

>> +use File::Temp qw/ :seekable /;
> 
> qw/ :seekable / does not appear in my version of Perl (5.8.8-7etch3 from
> Debian stable)  Just having "use File::Temp;" there works for me.

My newbishness in perl shows.  I'll change it to a simple 'use'.

>> +		seek $TEMP_FILES{$fd}, 0, 0 or croak $!;
> 
> 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.

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.

>> +		if (defined $autoflush) {
>> +			$TEMP_FILES{$fd}->autoflush($autoflush);
>> +		}
> 
> Given how much we interact with external programs, I'd rather force
> every autoflush on every file handle to avoid subtle bugs on
> different platforms.  It's faster in some (most?) cases, too.

That sounds good to me.

> 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.

-- 
Marcus Griep
GPG Key ID: 0x5E968152
——
http://www.boohaunt.net
את.ψο´

  reply	other threads:[~2008-08-09 15:46 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08 22:41 [PATCH] git-svn: Make it scream by minimizing temp files Marcus Griep
2008-08-08 22:59 ` Junio C Hamano
2008-08-09  1:12   ` Marcus Griep
2008-08-09  6:25 ` Eric Wong
2008-08-09 15:45   ` Marcus Griep [this message]
2008-08-10  1:46     ` Eric Wong
2008-08-10  3:53       ` Junio C Hamano
2008-08-10  7:47         ` Eric Wong
2008-08-10  8:26           ` Junio C Hamano
2008-08-10  8:09     ` Eric Wong
2008-08-11 15:53     ` [PATCH 0/3] git-svn and temporary file improvements Marcus Griep
2008-08-11 15:53       ` [PATCH 1/3] Git.pm: Add faculties to allow temp files to be cached Marcus Griep
2008-08-11 15:53         ` [PATCH 2/3] git-svn: Make it scream by minimizing temp files Marcus Griep
2008-08-11 15:53           ` [PATCH 3/3] git-svn: Reduce temp file usage when dealing with non-links Marcus Griep
2008-08-12  3:37             ` Eric Wong
2008-08-12 15:53               ` Marcus Griep
2008-08-12 16:01             ` Marcus Griep
2008-08-12 16:45               ` [PATCH v2 " Marcus Griep
2008-08-13  3:29               ` [PATCH " Eric Wong
2008-08-13  3:42                 ` Marcus Griep
2008-08-13  3:52                   ` Eric Wong
2008-08-12  3:14           ` [PATCH 2/3] git-svn: Make it scream by minimizing temp files Eric Wong
2008-08-12 15:50             ` Marcus Griep
2008-08-12 16:00           ` [PATCH 2/3] git-svn: Make it incrementally faster " Marcus Griep
2008-08-13  3:29             ` Eric Wong
2008-08-12  3:08         ` [PATCH 1/3] Git.pm: Add faculties to allow temp files to be cached Eric Wong
2008-08-12 15:41           ` Marcus Griep
2008-08-12 16:00         ` Marcus Griep
2008-08-13  3:28           ` Eric Wong
2008-08-13 20:05         ` Lea Wiemann
2008-08-13 20:13           ` Marcus Griep
2008-08-13 20:31             ` Marcus Griep
2008-08-13 20:38           ` Junio C Hamano
2008-08-13 22:28             ` Lea Wiemann
2008-08-13 22:30               ` [PATCH] Git.pm: require Perl 5.6.1 Lea Wiemann
2008-08-14  6:58             ` [PATCH 1/3] Git.pm: Add faculties to allow temp files to be cached Eric Wong
2008-08-15 15:10               ` [PATCH] Git.pm: Make File::Spec and File::Temp requirement lazy Marcus Griep
2008-08-15 19:31                 ` Bryan Donlan
2008-08-15 19:46                   ` Marcus Griep
2008-08-15 19:53                 ` [PATCH v2] " Marcus Griep
2008-08-13 20:52           ` [PATCH 1/3] Git.pm: Add faculties to allow temp files to be cached Miklos Vajna
2008-08-14  6:29         ` Junio C Hamano
2008-08-14 14:35           ` Marcus Griep

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=489DBB8A.2060207@griep.us \
    --to=marcus@griep.us \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).