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

[PATCH]? svn status performance (win32)

From: Martin Hauner <hauner_at_web.de>
Date: 2004-10-23 15:07:43 CEST

Hi,

at work we have a working copy that is not really small. It takes about 25
seconds to run svn status on it (from subcommander, build against the 1.1.x
branch with svn_utf_initialize()).

To find out what takes the time i did run it from Quantify.

Subversion spends a lot of time in io_check_path (-> apr_stat ->
GetFileAttributesEx).

I added a printf(filename) to io_check_path to find out if it is possible to
reduce the number of calls.
For each file in the wc io_check_path is called three times on the file itself
and two times on its property file.

I created three simple patches that reduce the 5 io_check_path calls to a single
call. They reduce the time needed for a status run about ~40% (not quantified,
i am at home). What do you think?

props.patch: removes an unecessary call on the properties file in
svn_wc__load_prop_file. svn_wc__load_prop_file calls svn_wc__load_prop_file
which does the same check.

status.patch: There are two calls to io_check_path here which are used to check
for a 'special' file. As far as I see the only special case is a link. As links
are not used on Win32 i #ifndef'ed them.

statusquestion.patch: Here I removed the io_check_path call in
svn_wc_text_modified_p. I created an svn_wc_text_modified_p2 method which does
no io_check_path call. The original svn_wc_text_modified_p does the check and
then calls svn_wc_text_modified_p2.
All calls to svn_wc_text_modified_p do in some way the io_check_path check. So
maybe just removing the check here is an option?

(The last patch may not cleanly apply, it is hand edited so it is seperated from
the previous patch that modifies the same function)

-- 
Martin (http://subcommander.tigris.org, a subversion gui client)

Removed unecessary svn_io_check_path call.

* subversion/libsvn_wc/props.c
  (svn_wc__load_prop_file): removed an unecessary svn_io_check_path
  call. svn_wc__load_prop_file already does the check.

Index: subversion/libsvn_wc/props.c
===================================================================
--- subversion/libsvn_wc/props.c (revision 11539)
+++ subversion/libsvn_wc/props.c (working copy)
@@ -844,15 +844,6 @@
   /* Construct a path to the relevant property file */
   SVN_ERR (svn_wc__prop_path (&prop_path, path, adm_access, FALSE, pool));
 
- /* Does the property file exist? */
- SVN_ERR (svn_io_check_path (prop_path, &pkind, pool));
-
- if (pkind == svn_node_none)
- /* No property file exists. Just go home, with an empty hash. */
- return SVN_NO_ERROR;
-
- /* else... */
-
   SVN_ERR (svn_wc__load_prop_file (prop_path, *props, pool));
 
   return SVN_NO_ERROR;

Removed svn_io_check_path calls to check for links which are uncessary
on the Win32 plattform.

* subversion/libsvn_wc/status.c
  (assemble_status): Initializing wc_special and node_special to false.
  Wrapped 'special' checks in #ifndef _WIN32.

Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 11539)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -212,8 +212,8 @@
   svn_boolean_t prop_modified_p = FALSE;
   svn_boolean_t locked_p = FALSE;
   svn_boolean_t switched_p = FALSE;
- svn_boolean_t wc_special;
- svn_boolean_t node_special;
+ svn_boolean_t wc_special = FALSE;
+ svn_boolean_t node_special = FALSE;
   svn_node_kind_t kind;
 
   /* Defaults for two main variables. */
@@ -223,7 +223,6 @@
   /* Check the path kind for PATH. */
   if (path_kind == svn_node_unknown)
     SVN_ERR (svn_io_check_path (path, &path_kind, pool));
- SVN_ERR (svn_io_check_special_path (path, &kind, &node_special, pool));
   
   if (! entry)
     {
@@ -305,7 +304,12 @@
       SVN_ERR (svn_wc_props_modified_p (&prop_modified_p, path, adm_access,
                                         pool));
 
+#ifndef _WIN32
+ // we don't have links on win32, so we can save some io_check_path calls
+ // on the file itself and its property file.
+ SVN_ERR (svn_io_check_special_path (path, &kind, &node_special, pool));
       SVN_ERR (svn_wc__get_special (&wc_special, path, adm_access, pool));
+#endif // _WIN32
 
       /* If the entry is a file, check for textual modifications */
       if ((entry->kind == svn_node_file) && (wc_special == node_special))

Removed another unecessary svn_io_check_path call.

* subversion/libsvn_wc/questions.c
  (svn_wc_text_modified_p2): copied from svn_wc_text_modified_p and
  removed the svn_io_check_path check.
  (svn_wc_text_modified_p): Does the svn_io_check_path check and then
  calls svn_wc_text_modified_p2.

* subversion/libsvn_wc/status.c
  (assemble_status): call svn_wc_text_modified_p2 instead of
  svn_wc_text_modified_p.

Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 11539)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -309,7 +308,7 @@
 
       /* If the entry is a file, check for textual modifications */
       if ((entry->kind == svn_node_file) && (wc_special == node_special))
- SVN_ERR (svn_wc_text_modified_p (&text_modified_p, path, FALSE,
+ SVN_ERR (svn_wc_text_modified_p2 (&text_modified_p, path, FALSE,
                                          adm_access, pool));
 
       if (text_modified_p)
Index: subversion/libsvn_wc/questions.c
===================================================================
--- subversion/libsvn_wc/questions.c (revision 11539)
+++ subversion/libsvn_wc/questions.c (working copy)
@@ -369,7 +369,7 @@
 
 
 svn_error_t *
-svn_wc_text_modified_p (svn_boolean_t *modified_p,
+svn_wc_text_modified_p2 (svn_boolean_t *modified_p,
                         const char *filename,
                         svn_boolean_t force_comparison,
                         svn_wc_adm_access_t *adm_access,
@@ -380,14 +380,6 @@
   apr_pool_t *subpool = svn_pool_create (pool);
   svn_node_kind_t kind;
 
- /* Sanity check: if the path doesn't exist, return FALSE. */
- SVN_ERR (svn_io_check_path (filename, &kind, subpool));
- if (kind != svn_node_file)
- {
- *modified_p = FALSE;
- goto cleanup;
- }
-
   if (! force_comparison)
     {
       /* See if the local file's timestamp is the same as the one
@@ -455,8 +447,29 @@
   return SVN_NO_ERROR;
 }
 
+svn_error_t *
+svn_wc_text_modified_p (svn_boolean_t *modified_p,
+ const char *filename,
+ svn_boolean_t force_comparison,
+ svn_wc_adm_access_t *adm_access,
+ apr_pool_t *pool)
+{
+ svn_node_kind_t kind;
 
+ /* Sanity check: if the path doesn't exist, return FALSE. */
+ SVN_ERR (svn_io_check_path (filename, &kind, pool));
+ if (kind != svn_node_file)
+ {
+ *modified_p = FALSE;
+ return SVN_NO_ERROR;
+ }
 
+ SVN_ERR (svn_wc_text_modified_p2 (modified_p, filename, FALSE,
+ adm_access, pool));
+
+ return SVN_NO_ERROR;
+}
+
 
 svn_error_t *
 svn_wc_conflicted_p (svn_boolean_t *text_conflicted_p,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 23 15:07:31 2004

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.