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

[PATCH] delta_files() speedup 2/3: keyword substitution

From: Stefan Fuhrmann <stefanfuhrmann_at_alice-dsl.de>
Date: Sun, 28 Mar 2010 14:50:38 +0200

Hi devs,

this is part of the delta_files() speedup patch series:
http://svn.haxx.se/dev/archive-2010-03/0604.shtml

translate_chunk spends most of its time in a loop
looking for the next '$' or newline. The call to strchr
is excessively expensive since the 'interesting' string
is no longer than 3 chars.

It is much more efficient to use a simple lookup table
(boolean array) that tells us whether a certain char
is 'interesting' or not. Since we call it for almost every
char in the file, the initialization overhead amortizes
within the first two lines of the respective file.

Performance gain is ~9%:

s~$ time ~/1.7-928181/svn export --ignore-externals -q $REPO/trunk /dev/shm/t
real 0m3.727s
user 0m3.189s
sys 0m0.542s

~$ time ~/1.7-patched/svn export --ignore-externals -q $REPO/trunk /dev/shm/t
real 0m3.410s
user 0m2.872s
sys 0m0.537s

-- Stefan^2.

[[[
Optimize the search for 'interesting' characters that
control the keyword substitution. For details see
http:// ...

* subversion/libsvn_subr/subst.c
  (translation_baton): the 'interesting' member is now
  a boolean array.
  (create_translation_baton): adapt initialization code
  (translate_chunk): eliminate call to strchr

patch by stefanfuhrmann < at > alice-dsl.de
]]]

Received on 2010-03-28 14:51:36 CEST

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.