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

[PATCH] Replace vdelta with singel insert op (was: [PATCH] Replace vdelta with xdelta variant)

From: Niels Werensteijn <n.werensteijn_at_student.utwente.nl>
Date: Tue, 22 Jan 2008 12:51:19 +0100

Summary so far:

New files, or new chunks of files have no source stream (chunk) to
compare it to, in order to make a diff of it. At this moment, vdelta
routine is used on these streams. This takes a lot of cpu power. Even
worse, since the diffs are compressed with zlib later on (both on disk
and during transmission), vdelta is actualy making it harder for zlib to
compress the stream, resulting in larger streams.

This patch:
In this patch I replace the call to vdelta with a single call to
svn_txdelta__insert_op and just insert the whole chunk as new data. This
costs almost no cpu time, and lets zlib compress it better.

My test results on two repositories confirmed that the on disk size
shrunk a little bit, and that cpu time was greatly reduced.

My time results:
Export Repository1 (delphi source code): from 58,6 to 42,0 seconds
Export Repository2 (big compressed bin): from 10,71 to 5,47 seconds

[[[
Replace vdelta with a single insert command

When creating delta's where the source stream is 0 length,
replace a call to the vdelta routine with the construction
of a single insert command, inserting the whole chunk. This
saves cpu time, and allows compression routines that work on
the delta streams to compress better.

* subversion/libsvn_delta/text_delta.c
    (compute_window): replace call to svn_txdelta__vdelta with
    a call to svn_txdelta__insert_op
]]]

Index: subversion/libsvn_delta/text_delta.c
===================================================================
--- subversion/libsvn_delta/text_delta.c (revision 28885)
+++ subversion/libsvn_delta/text_delta.c (working copy)
@@ -148,7 +148,10 @@
   build_baton.new_data = svn_stringbuf_create("", pool);
 
   if (source_len == 0)
- svn_txdelta__vdelta(&build_baton, data, source_len, target_len, pool);
+ /* There is no source stream, so just create an insert command
+ that inserts the whole chunk */
+ svn_txdelta__insert_op(&build_baton, svn_txdelta_new,
+ 0, target_len, data, pool);
   else
     svn_txdelta__xdelta(&build_baton, data, source_len, target_len, pool);
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-22 13:41:37 CET

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