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 2010/08/25 10:47:41 UTC

svn commit: r988898 - /subversion/branches/performance/subversion/libsvn_fs_fs/temp_serializer.c

Author: stefan2
Date: Wed Aug 25 08:47:41 2010
New Revision: 988898

URL: http://svn.apache.org/viewvc?rev=988898&view=rev
Log:
Consulting the C++ ARM and various C online resources, I verified 
that structure size and array stride are guaranteed to be identical.
I.e. sizeof(T) is equivalent to sizeof(T[1]) -> simplify the the code.

* subversion/libsvn_fs_fs/temp_serializer.c
  (serialize_dir, serialize_txdelta_ops):
   use sizeof(T) instead of sizeof(T[1]); improve commentary

Modified:
    subversion/branches/performance/subversion/libsvn_fs_fs/temp_serializer.c

Modified: subversion/branches/performance/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_fs_fs/temp_serializer.c?rev=988898&r1=988897&r2=988898&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/branches/performance/subversion/libsvn_fs_fs/temp_serializer.c Wed Aug 25 08:47:41 2010
@@ -272,7 +272,7 @@ serialize_dir(apr_hash_t *entries, apr_p
 
   /* calculate sizes */
   apr_size_t count = apr_hash_count(entries);
-  apr_size_t entries_len = count * sizeof(svn_fs_dirent_t*[1]);
+  apr_size_t entries_len = count * sizeof(svn_fs_dirent_t*);
 
   /* copy the hash entries to an auxilliary struct of known layout */
   hash_data.count = count;
@@ -287,7 +287,8 @@ serialize_dir(apr_hash_t *entries, apr_p
         sizeof(*hash_data.entries),
         compare_dirent_id_names);
 
-  /* serialize that aux. structure into a new  */
+  /* Serialize that aux. structure into a new one. Also, provide a good
+   * estimate for the size of the buffer that we will need. */
   context = svn_temp_serializer__init(&hash_data,
                                       sizeof(hash_data),
                                       50 + count * 200 + entries_len,
@@ -419,10 +420,10 @@ serialize_txdelta_ops(svn_temp_serialize
   if (*ops == NULL)
     return;
 
-  /* the ops form a simple chunk of memory with no further references */
+  /* the ops form a contiguous chunk of memory with no further references */
   svn_temp_serializer__push(context,
                             (const void * const *)ops,
-                            count * sizeof(svn_txdelta_op_t[1]));
+                            count * sizeof(svn_txdelta_op_t));
   svn_temp_serializer__pop(context);
 }