You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/11/03 09:12:36 UTC

svn commit: r1712223 - /subversion/trunk/subversion/mod_dav_svn/util.c

Author: ivan
Date: Tue Nov  3 08:12:36 2015
New Revision: 1712223

URL: http://svn.apache.org/viewvc?rev=1712223&view=rev
Log:
Do not insert newlines in base64 encoded responses in mod_dav_svn. This is
slightly reduce CPU usage on the client since it could decode responses with
bigger chunks instead line-by-line.

* subversion/mod_dav_svn/util.c
  (dav_svn__make_base64_output_stream): Call svn_base64_encode2() with
   BREAK_LINES=FALSE.

Modified:
    subversion/trunk/subversion/mod_dav_svn/util.c

Modified: subversion/trunk/subversion/mod_dav_svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/util.c?rev=1712223&r1=1712222&r2=1712223&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/util.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/util.c Tue Nov  3 08:12:36 2015
@@ -620,7 +620,7 @@ dav_svn__make_base64_output_stream(apr_b
   wb->output = output;
   svn_stream_set_write(stream, brigade_write_fn);
 
-  return svn_base64_encode2(stream, TRUE, pool);
+  return svn_base64_encode2(stream, FALSE, pool);
 }
 
 void



Re: svn commit: r1712223 - /subversion/trunk/subversion/mod_dav_svn/util.c

Posted by Ivan Zhakov <iv...@visualsvn.com>.
On 3 November 2015 at 11:31, Branko Čibej <br...@apache.org> wrote:
> On 03.11.2015 09:12, ivan@apache.org wrote:
>> Author: ivan
>> Date: Tue Nov  3 08:12:36 2015
>> New Revision: 1712223
>>
>> URL: http://svn.apache.org/viewvc?rev=1712223&view=rev
>> Log:
>> Do not insert newlines in base64 encoded responses in mod_dav_svn. This is
>> slightly reduce CPU usage on the client since it could decode responses with
>> bigger chunks instead line-by-line.
>
> This looks like one of those micro-optimisations that you like to
> complain about ... does it really make a measurable difference?
It's not micro-optimization actually.

> A sane Base64 decoder should just ignore any newlines in the encoded stream and
> not try to split it into lines first. If our decoder /does/ read the
> response line-by-line, then I propose that's a better place for a
> performance improving fix.
>
The problem that XML parser feeds us CDATA in line-by-line basis:
expat parser removes newlines on his own when parses CDATA. One base64
line contains about 60 bytes of data, so we end up processing data
through all stack by such small chunks.

> The (minor) downside of your change is that it makes it just a bit
> harder to read wire dumps.
>
We already encode XML tags without newlines in many places. In some
places we use mod_dav's DEBUG_CR to find whether to add newlines for
easier reading wire dumps.


-- 
Ivan Zhakov

Re: svn commit: r1712223 - /subversion/trunk/subversion/mod_dav_svn/util.c

Posted by Branko Čibej <br...@apache.org>.
On 03.11.2015 09:12, ivan@apache.org wrote:
> Author: ivan
> Date: Tue Nov  3 08:12:36 2015
> New Revision: 1712223
>
> URL: http://svn.apache.org/viewvc?rev=1712223&view=rev
> Log:
> Do not insert newlines in base64 encoded responses in mod_dav_svn. This is
> slightly reduce CPU usage on the client since it could decode responses with
> bigger chunks instead line-by-line.

This looks like one of those micro-optimisations that you like to
complain about ... does it really make a measurable difference? A sane
Base64 decoder should just ignore any newlines in the encoded stream and
not try to split it into lines first. If our decoder /does/ read the
response line-by-line, then I propose that's a better place for a
performance improving fix.

The (minor) downside of your change is that it makes it just a bit
harder to read wire dumps.

-- Brane