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

Re: [Issue 1240] Changed - svn_subst_translate_stream() should read bigger chunks

From: Robert Pluim <rpluim_at_bigfoot.com>
Date: 2003-04-14 19:23:24 CEST

Karl Fogel writes:
> Michael Wood <mwood@its.uct.ac.za> writes:
> > > + Mike Pilato points out that the problem may not be the one-byte reads,
> > > + since that I/O is presumably buffered. So the first thing is to do
> > ^^^^^^^^^^
> >
> > Is it though? Haven't checked. This assumption just jumped out at me
> > :)
>
> Yup, that wasn't an assertion, it was merely a note *not* to blindly
> assume that I/O is the problem.

Two data points:

in svn_subst_copy_and_translate, the source file used for translation
is opened as follows:

  SVN_ERR (svn_io_file_open (&s, src, APR_READ | APR_BUFFERED,
                             APR_OS_DEFAULT, pool));

which tells me that it _should_ be buffered, right?

Secondly, on my FreeBSD box, checking out the subversion source over
http gives the following profile info for svn_subst_translate_stream

                                  called/total parents
index %time self descendents called+self name index
                                  called/total children

                0.48 4.18 730/730 svn_subst_copy_and_translate [6]
[7] 26.0 0.48 4.18 730 svn_subst_translate_stream [7]
                0.25 1.98 9630507/9925261 translate_write [13]
                0.22 1.65 9968018/9968018 svn_stream_read [16]
                0.01 0.07 294754/294754 translate_newline [102]
                0.00 0.00 1460/3898 svn_stream_close [743]
                0.00 0.00 770/770 translate_keyword [758]

translate_write doesn't really do much, but it's called an awful lot.
I replaced it with a shameful hack which just buffers all the bytes
and calls svn_stream_write once at the end of the file, and got:

                0.58 2.02 731/731 svn_subst_copy_and_translate [11]
[12] 15.7 0.58 2.02 731 svn_subst_translate_stream [12]
                0.22 1.63 9975019/9975019 svn_stream_read [15]
                0.17 0.00 9637151/9932110 translate_write [73]
                0.00 0.01 294959/294959 translate_newline [276]
                0.00 0.00 1462/3903 svn_stream_close [390]
                0.00 0.00 731/13248 svn_stream_write [215]
                0.00 0.00 770/770 translate_keyword [670]

Of course, that wouldn't work as a general solution, but we could
consider having a buffer in svn_subst_translate_stream that we flush
to disk every n characters, to avoid having to descend the call chain
into the depths of apr for every byte. Something similar could be
done for svn_stream_read, but that's more work.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 14 19:23:19 2003

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