You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Chia-liang Kao <cl...@clkao.org> on 2003/08/21 20:02:23 UTC

subst_translate_stream inefficiency

Hi,

During my development of SVN::Stream (bidirectional svn_stream
and perl io object interpolation), i found that libsvn_client's
cat is doing 1 byte write to the stream instead of chunks.

So I found this happends when svn:keyword or eol-style is set
on the file. altough the actual disk write will not happen every
write, <filesize> numbers of call to stream->write is still scary.

Attached is a script using the perl bindings to do some statistics
of the writes, and here is the result:

client.pl http://svn.collab.net/repos/svn/trunk/subversion/mod_authz_svn/mod_autz_svn.c
11001 writes at /tmp/client.pl line 19.
client.pl http://svn.collab.net/repos/svn/trunk/subversion/mod_authz_svn/INSTALL
7 writes writes at /tmp/client.pl line 18.

Cheers,
CLK

#!/usr/bin/perl
package PerlIO::via::count;

use strict;
sub PUSHED { bless \*PUSHED,$_[0] }
sub FILL { readline( $_[1] ) }

my $write_cnt;

sub WRITE {
    $write_cnt++;
    print {$_[2]} $_[1];
    return length($_[1]);
} #WRITE

END {
    warn "$write_cnt writes";
}

1;

package main;

use SVN::Core;
use SVN::Client ();

my $ctx = SVN::_Client::new_svn_client_ctx_t;
$ctx->auth_baton (SVN::Core::auth_open ([SVN::Client::get_username_provider]));

open( my $out,'>:via(count)','/dev/null' );
SVN::Client::cat ($out, shift, 'HEAD', $ctx);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: subst_translate_stream inefficiency

Posted by Greg Hudson <gh...@MIT.EDU>.
On Thu, 2003-08-21 at 16:02, Chia-liang Kao wrote:
> During my development of SVN::Stream (bidirectional svn_stream
> and perl io object interpolation), i found that libsvn_client's
> cat is doing 1 byte write to the stream instead of chunks.

The just means the stream you send the data to is expected to buffer. 
(It's still not wildly efficient to make a function call per bytes, but
it's not that bad either.)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org