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

RE: [PATCH] Saving a few cycles, part 1/2

From: Bert Huijben <bert_at_vmoo.com>
Date: Sun, 25 Apr 2010 20:17:39 +0200

> -----Original Message-----
> From: Stefan Fuhrmann [mailto:stefanfuhrmann_at_alice-dsl.de]
> Sent: zondag 25 april 2010 16:52
> To: dev_at_subversion.apache.org
> Subject: [PATCH] Saving a few cycles, part 1/2
> Hi devs,
> further reducing my backlog of patches sitting in my working copy, this
> the next patch optimize code locally - shaving off cycles here and there.
> net effect is somewhere between 3 and 10 percent for repository access
> export, etc.).
> In this patch, I eliminated calls to memcpy for small copies as they are
> particularly expensive in the MS CRT.

Which CRT did you use for these measurements? (2005, 2008, 2010, Debug vs
Release and DLL vs Static?). Which compiler version? (Standard/Express or
Professional+). (I assume you use the normal Subversion build using .sln
files and not the TortoiseSVN scripts? Did you use the shared library builds
or a static build)?

Did you try enabling the intrinsincs for this method instead of using a
handcoded copy?

I'm pretty sure that the modern variants enable inlined optimized assembly
for memcpy in release mode (and certainly if you ask for that using the
right #pragma), but enabling profiling on the linker or advanced debugging
options will probably disable all that. I would be extremely surprised if
this optimized assembler is measurable slower than the CRT on other OSs as
copying memory is a pretty elementary operation.
(But I'm pretty certain that the debug CRT with variable usage and memory
usage tracking is slower than the other CRT's.. But that is why we deliver
applications in release mode)

In my performance measurements the only case where I saw a memcpy turn up
was in the apr pool functions. (This was while using a profiler that didn't
touch the code (just timed measure points) and tracing on optimized release
mode binaries)

> -- Stefan^2.
> [[[
> Eliminate memcpy from critical paths during reading data from the
> repository.
> * subversion/libsvn_delta/text_delta.c
> (svn_txdelta_apply_instructions): replace memcpy
> for small amounts of data; optimize overlapping
> copies; optimize 'buffer full' detection
> * subversion/libsvn_subr/svn_string.c
> (svn_stringbuf_appendbytes): replace memcpy
> with specialized code when adding single chars.
> ]]]
Received on 2010-04-25 20:18:13 CEST

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