[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: export, checkout, commit performance

From: <kfogel_at_collab.net>
Date: 2006-03-10 00:14:51 CET

kfogel@collab.net writes:
> Julian Foad <julianfoad@btopenworld.com> writes:
> > Branko Čibej wrote:
> > > How about this one, as a stopgap:
> > > Index: subversion/libsvn_subr/io.c
> > > ===================================================================
> > > --- subversion/libsvn_subr/io.c (revision 18760)
> > > +++ subversion/libsvn_subr/io.c (working copy)
> > > @@ -988,7 +988,7 @@
> > > struct apr_md5_ctx_t context;
> > > apr_file_t *f = NULL;
> > > svn_error_t *err;
> > > - char buf[BUFSIZ]; /* What's a good size for a read chunk? */
> > > + char *buf = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
> > > apr_size_t len;
> > > /* ### The apr_md5 functions return apr_status_t, but they only
> > > @@ -999,12 +999,12 @@
> > > SVN_ERR(svn_io_file_open(&f, file, APR_READ, APR_OS_DEFAULT,
> > > pool));
> > > - len = sizeof(buf);
> > > + len = SVN__STREAM_CHUNK_SIZE;
> > > err = svn_io_file_read(f, buf, &len, pool);
> > > while (! err)
> > > {
> > > apr_md5_update(&context, buf, len);
> > > - len = sizeof(buf);
> > > + len = SVN__STREAM_CHUNK_SIZE;
> > > err = svn_io_file_read(f, buf, &len, pool);
> > > };
> >
> > +1, except don't just change this function but also all the other
> > places we use it: that's two other functions in io.c, and also:
> > subversion/libsvn_wc/entries.c:read_entries(),
> > subversion/libsvn_wc/log.c:run_log(),
> > subversion/svnlook/main.c:do_cat().
>
> Why would we ever not use sizeof() when calculating len, though? It's
> always right. It can never be wrong. To the argument that we would
> never change the buffer's size, I point to this patch as
> counter-evidence :-).
>
> +1 on moving from BUFSIZ to SVN__STREAM_CHUNK_SIZE, -0.9 on writing
> out SVN__STREAM_CHUNK_SIZE instead of just using sizeof().

D'oh, my apologies. I read too quickly and missed the fact that we're
going from static allocation to pool allocation.

Stepping away from the computer,
-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 10 02:02:30 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.