Stefan Fuhrmann <>

r956593, r941243, r921057

r956593 | julianfoad | 2010-06-21 08:56:30 -0500 (Mon, 21 Jun 2010)

Optimize the copies performed by svn_txdelta_apply_instructions().

svn_txdelta_apply_instructions() is relatively slow for long instruction
sequences copying small pieces of data.  This is particularly visible in
"format 2" FSFS repositories.

Two kinds of copy are involved.  For simple copies, the system's memcpy()
is used, which is fast for long lengths; this patch bypasses it for very
short lengths.  For intentionally overlapping copies, a custom loop is used,
which was already fast for very short lengths; this patch adds a code path
that is fast for longer lengths.

* subversion/libsvn_delta/text_delta.c
  (fast_memcpy, patterning_copy): New functions, optimized for our specific
  (svn_txdelta_apply_instructions): Use fast_memcpy() and patterning_copy().

Patch by: Stefan Fuhrmann <stefanfuhrmann{_AT_}>
(I tweaked the comments and split Stefan's patch into two parts, of which
this is the first.)

r941243 | julianfoad | 2010-05-05 06:01:40 -0500 (Wed, 05 May 2010)

Various local optimizations.  These opportunities became visible after
significantly optimizing other parts of svn.  The total savings for a 'svn
export' is almost 3 percent.

The largest savings can be attributed to the svndiff.c
changes (~1.5%) and the checksum parser (~1%).

* subversion/include/svn_delta.h
  (enum svn_delta_action): Document that these enum values must match the
    encoding values.

* subversion/libsvn_delta/compose_delta.c
  (search_offset_index, copy_source_ops): Use size_t to index memory. This
    is mainly a consistency fix but may actually result in slightly higher
    performance due to fewer conversions.

* subversion/libsvn_delta/svndiff.c
  (decode_file_offset, decode_size): Use slightly more efficient
  (decode_instruction): Directly map action codes, avoiding a 'switch'.

* subversion/libsvn_subr/checksum.c
  (svn_checksum_parse_hex): Eliminate calls to locale-aware CRT functions.
    At least with MS compilers, these are very expensive.

* subversion/libsvn_subr/stream.c
  (stream_readline): Hoist 'numbytes' from the loop: it is invariant until

Patch by: Stefan Fuhrmann <stefanfuhrmann{_AT_}>

r921057 | julianfoad | 2010-03-09 13:04:00 -0600 (Tue, 09 Mar 2010)

Speed up input stream processing in config parser and others that read
single bytes from a stream.

* subversion/libsvn_subr/subst.c
  (translated_stream_read): Add an optimized code path for single byte read

Patch by: Stefan Fuhrmann <stefanfuhrmann{_AT_}>