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 2016/01/21 19:34:16 UTC
svn commit: r1726053 -
/subversion/trunk/subversion/libsvn_fs_x/temp_serializer.c
Author: stefan2
Date: Thu Jan 21 18:34:16 2016
New Revision: 1726053
URL: http://svn.apache.org/viewvc?rev=1726053&view=rev
Log:
* subversion/libsvn_fs_x/temp_serializer.c
(serialize_dir): Give a better estimate for the size of serialized dir in
FSX. Don't forget that this is still only the initial
buffer size and will be auto-resized if necessary.
Modified:
subversion/trunk/subversion/libsvn_fs_x/temp_serializer.c
Modified: subversion/trunk/subversion/libsvn_fs_x/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/temp_serializer.c?rev=1726053&r1=1726052&r2=1726053&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/temp_serializer.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/temp_serializer.c Thu Jan 21 18:34:16 2016
@@ -259,6 +259,9 @@ serialize_dir(svn_fs_x__dir_data_t *dir,
* sizeof(svn_fs_x__dirent_t*);
apr_size_t lengths_len = (count + over_provision) * sizeof(apr_uint32_t);
+ /* Estimate the size of a directory entry + its name. */
+ enum { ENTRY_SIZE = sizeof(svn_fs_x__dirent_t) + 32 };
+
/* copy the hash entries to an auxiliary struct of known layout */
dir_data.count = count;
dir_data.txn_filesize = dir->txn_filesize;
@@ -274,7 +277,8 @@ serialize_dir(svn_fs_x__dir_data_t *dir,
* estimate for the size of the buffer that we will need. */
context = svn_temp_serializer__init(&dir_data,
sizeof(dir_data),
- 50 + count * 100 + entries_len,
+ 50 + count * ENTRY_SIZE
+ + entries_len + lengths_len,
scratch_pool);
/* serialize entries references */