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/01/05 19:12:17 UTC
svn commit: r1649603 - /subversion/trunk/subversion/libsvn_fs_x/dag.c
Author: stefan2
Date: Mon Jan 5 18:12:16 2015
New Revision: 1649603
URL: http://svn.apache.org/r1649603
Log:
Reduce the memory and cache footprint of FSX DAG nodes.
The CREATED_PATH member is often redundant.
* subversion/libsvn_fs_x/dag.c
(svn_fs_x__dag_dup): Don't duplicate the c-path if we can just take it
from the noderev sub-structure.
(svn_fs_x__dag_serialize,
svn_fs_x__dag_deserialize): Don't cache the c-path seperately if we
have a noderev to take it from.
Modified:
subversion/trunk/subversion/libsvn_fs_x/dag.c
Modified: subversion/trunk/subversion/libsvn_fs_x/dag.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/dag.c?rev=1649603&r1=1649602&r2=1649603&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/dag.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/dag.c Mon Jan 5 18:12:16 2015
@@ -1100,13 +1100,18 @@ svn_fs_x__dag_dup(const dag_node_t *node
{
/* Allocate our new node. */
dag_node_t *new_node = apr_pmemdup(pool, node, sizeof(*new_node));
- new_node->created_path = apr_pstrdup(pool, node->created_path);
/* Only copy cached svn_fs_x__noderev_t for immutable nodes. */
if (node->node_revision && !svn_fs_x__dag_check_mutable(node))
- new_node->node_revision = copy_node_revision(node->node_revision, pool);
+ {
+ new_node->node_revision = copy_node_revision(node->node_revision, pool);
+ new_node->created_path = new_node->node_revision->created_path;
+ }
else
- new_node->node_revision = NULL;
+ {
+ new_node->node_revision = NULL;
+ new_node->created_path = apr_pstrdup(pool, node->created_path);
+ }
new_node->node_pool = pool;
@@ -1140,18 +1145,20 @@ svn_fs_x__dag_serialize(void **data,
/* for mutable nodes, we will _never_ cache the noderev */
if (node->node_revision && !svn_fs_x__dag_check_mutable(node))
- svn_fs_x__noderev_serialize(context, &node->node_revision);
+ {
+ svn_fs_x__noderev_serialize(context, &node->node_revision);
+ }
else
- svn_temp_serializer__set_null(context,
- (const void * const *)&node->node_revision);
+ {
+ svn_temp_serializer__set_null(context,
+ (const void * const *)&node->node_revision);
+ svn_temp_serializer__add_string(context, &node->created_path);
+ }
/* The deserializer will use its own pool. */
svn_temp_serializer__set_null(context,
(const void * const *)&node->node_pool);
- /* serialize other sub-structures */
- svn_temp_serializer__add_string(context, &node->created_path);
-
/* return serialized data */
serialized = svn_temp_serializer__get(context);
*data = serialized->data;
@@ -1178,7 +1185,10 @@ svn_fs_x__dag_deserialize(void **out,
svn_fs_x__noderev_deserialize(node, &node->node_revision, pool);
node->node_pool = pool;
- svn_temp_deserializer__resolve(node, (void**)&node->created_path);
+ if (node->node_revision)
+ node->created_path = node->node_revision->created_path;
+ else
+ svn_temp_deserializer__resolve(node, (void**)&node->created_path);
/* return result */
*out = node;