You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/04/13 07:57:24 UTC

svn commit: r1586924 - /subversion/trunk/subversion/libsvn_repos/log.c

Author: stefan2
Date: Sun Apr 13 05:57:23 2014
New Revision: 1586924

URL: http://svn.apache.org/r1586924
Log:
Minor optimization to 'svn log -g'.

* subversion/libsvn_repos/log.c
  (fs_mergeinfo_changed): Defer hash key access and pool cleanup until
                          we may use them.  Also, handle modified nodes
                          first since they are the majority.

Modified:
    subversion/trunk/subversion/libsvn_repos/log.c

Modified: subversion/trunk/subversion/libsvn_repos/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/log.c?rev=1586924&r1=1586923&r2=1586924&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/log.c (original)
+++ subversion/trunk/subversion/libsvn_repos/log.c Sun Apr 13 05:57:23 2014
@@ -763,16 +763,16 @@ fs_mergeinfo_changed(svn_mergeinfo_catal
        hi;
        hi = apr_hash_next(hi))
     {
-      const char *changed_path = svn__apr_hash_index_key(hi);
+      const char *changed_path;
       svn_fs_path_change2_t *change = svn__apr_hash_index_val(hi);
       const char *base_path = NULL;
       svn_revnum_t base_rev = SVN_INVALID_REVNUM;
       svn_fs_root_t *base_root = NULL;
       svn_string_t *prev_mergeinfo_value = NULL, *mergeinfo_value;
 
-      svn_pool_clear(iterpool);
+      /* Cheap pre-checks that don't require memory allocation etc. */
 
-      /* If there was no mergeinfo change on this item, ignore it. */
+      /* No mergeinfo change? -> nothing to do here. */
       if (change->mergeinfo_mod == svn_tristate_false)
         continue;
 
@@ -780,6 +780,10 @@ fs_mergeinfo_changed(svn_mergeinfo_catal
       if (! change->prop_mod)
         continue;
 
+      /* Begin actual processing */
+      changed_path = svn__apr_hash_index_key(hi);
+      svn_pool_clear(iterpool);
+
       switch (change->change_kind)
         {
 
@@ -788,20 +792,6 @@ fs_mergeinfo_changed(svn_mergeinfo_catal
            ### difference would be the fallback case (path/rev-1 for
            ### modifies, NULL otherwise).  -- cmpilato  */
 
-        /* If the path was added or replaced, see if it was created via
-           copy.  If so, set BASE_REV/BASE_PATH to its previous location.
-           If not, there's no previous location to examine -- leave
-           BASE_REV/BASE_PATH = -1/NULL.  */
-        case svn_fs_path_change_add:
-        case svn_fs_path_change_replace:
-        case svn_fs_path_change_move:
-        case svn_fs_path_change_movereplace:
-          {
-            SVN_ERR(svn_fs_copied_from(&base_rev, &base_path,
-                                       root, changed_path, iterpool));
-            break;
-          }
-
         /* If the path was merely modified, see if its previous
            location was affected by a copy which happened in this
            revision before assuming it holds the same path it did the
@@ -826,6 +816,20 @@ fs_mergeinfo_changed(svn_mergeinfo_catal
             break;
           }
 
+        /* If the path was added or replaced, see if it was created via
+           copy.  If so, set BASE_REV/BASE_PATH to its previous location.
+           If not, there's no previous location to examine -- leave
+           BASE_REV/BASE_PATH = -1/NULL.  */
+        case svn_fs_path_change_add:
+        case svn_fs_path_change_replace:
+        case svn_fs_path_change_move:
+        case svn_fs_path_change_movereplace:
+          {
+            SVN_ERR(svn_fs_copied_from(&base_rev, &base_path,
+                                       root, changed_path, iterpool));
+            break;
+          }
+
         /* We don't care about any of the other cases. */
         case svn_fs_path_change_delete:
         case svn_fs_path_change_reset: