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 2015/09/11 02:11:56 UTC
svn commit: r1702354 - /subversion/trunk/subversion/libsvn_ra_svn/marshal.c
Author: stefan2
Date: Fri Sep 11 00:11:55 2015
New Revision: 1702354
URL: http://svn.apache.org/r1702354
Log:
Increase the default tuple buffer size in ra-svn such that any of the
protocol-defined tuples will fit in there without reallocation.
* subversion/libsvn_ra_svn/marshal.c
(read_item): Bump the initial size to 12 and add a longish comment
explaining the rationale and allocation behavior.
Modified:
subversion/trunk/subversion/libsvn_ra_svn/marshal.c
Modified: subversion/trunk/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/marshal.c?rev=1702354&r1=1702353&r2=1702354&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/marshal.c Fri Sep 11 00:11:55 2015
@@ -1294,8 +1294,18 @@ static svn_error_t *read_item(svn_ra_svn
}
else if (c == '(')
{
- /* Allow for up to 4 items in this list without re-allocation. */
- svn_ra_svn__item_t stack_items[4];
+ /* The largest struct that the protocol currently defines has 10
+ * elements (log-entry) and add some headroom for future extensions.
+ * At a maximum nesting level of 64 this use <= 18kB of stack.
+ *
+ * All system-defined data structures will fit into this and will be
+ * copied into ITEM after a single apr_palloc with no over-provision.
+ * Unbounded lists with more than 12 but less than 25 entries will
+ * also see only a single allocation from POOL. However, there will
+ * be some over-provision. Longer lists will see log N resizes and
+ * O(N) total cost.
+ */
+ svn_ra_svn__item_t stack_items[12];
svn_ra_svn__item_t *items = stack_items;
int capacity = sizeof(stack_items) / sizeof(stack_items[0]);
int count = 0;