http://www.sqlite.org/pragma.html#pragma_page_size

Apparently changing the PAGE_SIZE pragma has a significant effect on the
wc speed:

% rm -rf d && time ( export _SVN_PRAGMA='PRAGMA page_size = 65536;'; echo $svn; 
$svn co -q file:///tmp/svn/r1 d && $svn pl -R d >/dev/null )
/home/daniel/src/svn/t1/subversion/svn/svn
\                                     
Time spent in user mode  (CPU seconds)  : 5.73ss
Time spent in kernel mode (CPU seconds) : 14.11ss
Total time                              : 28.70ss
% rm -rf d && time ( export _SVN_PRAGMA='PRAGMA page_size = 65536;'; echo $svn; 
$svn co -q file:///tmp/svn/r1 d && $svn pl -R d >/dev/null )
/home/daniel/src/svn/t1/subversion/svn/svn
\                                     
Time spent in user mode  (CPU seconds)  : 5.86ss
Time spent in kernel mode (CPU seconds) : 14.24ss
Total time                              : 29.19ss

% rm -rf d && time ( export _SVN_PRAGMA='PRAGMA page_size = 4096;'; echo $svn; 
$svn co -q file:///tmp/svn/r1 d && $svn pl -R d >/dev/null )
/home/daniel/src/svn/t1/subversion/svn/svn
\                                     
Time spent in user mode  (CPU seconds)  : 5.29ss
Time spent in kernel mode (CPU seconds) : 5.44ss
Total time                              : 20.56ss
% rm -rf d && time ( export _SVN_PRAGMA='PRAGMA page_size = 4096;'; echo $svn; 
$svn co -q file:///tmp/svn/r1 d && $svn pl -R d >/dev/null )
/home/daniel/src/svn/t1/subversion/svn/svn
\                                     
Time spent in user mode  (CPU seconds)  : 4.82ss
Time spent in kernel mode (CPU seconds) : 6.20ss
Total time                              : 19.51ss

% rm -rf d && time ( export _SVN_PRAGMA='PRAGMA page_size = 1024;'; echo $svn; 
$svn co -q file:///tmp/svn/r1 d && $svn pl -R d >/dev/null ) 
/home/daniel/src/svn/t1/subversion/svn/svn
\                                     
Time spent in user mode  (CPU seconds)  : 5.25ss
Time spent in kernel mode (CPU seconds) : 5.30ss
Total time                              : 19.06ss
% rm -rf d && time ( export _SVN_PRAGMA='PRAGMA page_size = 1024;'; echo $svn; 
$svn co -q file:///tmp/svn/r1 d && $svn pl -R d >/dev/null )
/home/daniel/src/svn/t1/subversion/svn/svn
\                                     
Time spent in user mode  (CPU seconds)  : 5.00ss
Time spent in kernel mode (CPU seconds) : 6.72ss
Total time                              : 15.81ss

(wc resides on /tmp ext3 partition, checkout is to /home ext3 partition
on the same disk, using current trunk binaries, with the attached patch,
using sqlite-3.7.3 from Debian.  I've verified that the pragma took
effect by running 'sqlite3 "pragma page_size;"' afterwards.)

Now, obviously just using the 65k (the maximum) for the pragma isn't
always a good idea; but should we make this configurable?  I imagine
that using, say, 4KB in some setups could have a noticeable difference.

Index: subversion/libsvn_subr/sqlite.c
===================================================================
--- subversion/libsvn_subr/sqlite.c	(revision 1244784)
+++ subversion/libsvn_subr/sqlite.c	(working copy)
@@ -811,6 +811,10 @@ svn_sqlite__open(svn_sqlite__db_t **db, const char
      setting SQLITE_TEMP_STORE to 0 (always to disk) */
   svn_error_clear(exec_sql(*db, "PRAGMA temp_store = MEMORY;"));
 
+  /* Testing */
+  if (getenv("_SVN_PRAGMA"))
+    SVN_ERR(exec_sql(*db, getenv("_SVN_PRAGMA")));
+
   /* Store the provided statements. */
   if (statements)
     {

Reply via email to