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 2013/07/20 00:32:07 UTC
svn commit: r1505056 - in /subversion/trunk: ./
subversion/include/private/svn_temp_serializer.h
subversion/libsvn_fs_fs/temp_serializer.c
subversion/libsvn_subr/temp_serializer.c
Author: stefan2
Date: Fri Jul 19 22:32:06 2013
New Revision: 1505056
URL: http://svn.apache.org/r1505056
Log:
Merge revision r1442068 from branches/fsfs-format7.
This speeds up the serialization into cache buffer format.
Modified:
subversion/trunk/ (props changed)
subversion/trunk/subversion/include/private/svn_temp_serializer.h
subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c
subversion/trunk/subversion/libsvn_subr/temp_serializer.c
Propchange: subversion/trunk/
------------------------------------------------------------------------------
Merged /subversion/branches/fsfs-format7:r1442068
Modified: subversion/trunk/subversion/include/private/svn_temp_serializer.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_temp_serializer.h?rev=1505056&r1=1505055&r2=1505056&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_temp_serializer.h (original)
+++ subversion/trunk/subversion/include/private/svn_temp_serializer.h Fri Jul 19 22:32:06 2013
@@ -143,6 +143,22 @@ void
svn_temp_serializer__pop(svn_temp_serializer__context_t *context);
/**
+ * Serialize a referenced sub-structure within the serialization
+ * @a context. @a source_struct must be a reference to the
+ * pointer in the original parent structure so that the correspondence in
+ * the serialized structure can be established. @a struct_size must match
+ * the result of @c sizeof() of the actual structure.
+ *
+ * This function is equivalent but more efficient than calling
+ * #svn_temp_serializer__push() immediately followed by
+ * #svn_temp_serializer__pop().
+ */
+void
+svn_temp_serializer__add_leaf(svn_temp_serializer__context_t *context,
+ const void * const * source_struct,
+ apr_size_t struct_size);
+
+/**
* Serialize a string referenced from the current structure within the
* serialization @a context. @a s must be a reference to the @c char*
* pointer in the original structure so that the correspondence in the
Modified: subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c?rev=1505056&r1=1505055&r2=1505056&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/temp_serializer.c Fri Jul 19 22:32:06 2013
@@ -106,13 +106,12 @@ serialize_svn_string(svn_temp_serializer
/* the "string" content may actually be arbitrary binary data.
* Thus, we cannot use svn_temp_serializer__add_string. */
- svn_temp_serializer__push(context,
- (const void * const *)&string->data,
- string->len + 1);
+ svn_temp_serializer__add_leaf(context,
+ (const void * const *)&string->data,
+ string->len + 1);
/* back to the caller's nesting level */
svn_temp_serializer__pop(context);
- svn_temp_serializer__pop(context);
}
/* Utility function to deserialize the STRING inside the BUFFER.
@@ -144,13 +143,12 @@ serialize_checksum(svn_temp_serializer__
/* The digest is arbitrary binary data.
* Thus, we cannot use svn_temp_serializer__add_string. */
- svn_temp_serializer__push(context,
- (const void * const *)&checksum->digest,
- svn_checksum_size(checksum));
+ svn_temp_serializer__add_leaf(context,
+ (const void * const *)&checksum->digest,
+ svn_checksum_size(checksum));
/* return to the caller's nesting level */
svn_temp_serializer__pop(context);
- svn_temp_serializer__pop(context);
}
/* Utility function to deserialize the checksum CS inside the BUFFER.
@@ -434,10 +432,9 @@ serialize_txdelta_ops(svn_temp_serialize
return;
/* 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));
- svn_temp_serializer__pop(context);
+ svn_temp_serializer__add_leaf(context,
+ (const void * const *)ops,
+ count * sizeof(svn_txdelta_op_t));
}
/* Utility function to serialize W in the given serialization CONTEXT.
@@ -1274,22 +1271,19 @@ svn_fs_fs__serialize_mergeinfo(void **da
svn_temp_serializer__pop(context);
/* key lengths array */
- svn_temp_serializer__push(context,
- (const void * const *)&merges.key_lengths,
- merges.count * sizeof(*merges.key_lengths));
- svn_temp_serializer__pop(context);
+ svn_temp_serializer__add_leaf(context,
+ (const void * const *)&merges.key_lengths,
+ merges.count * sizeof(*merges.key_lengths));
/* range counts array */
- svn_temp_serializer__push(context,
- (const void * const *)&merges.range_counts,
- merges.count * sizeof(*merges.range_counts));
- svn_temp_serializer__pop(context);
+ svn_temp_serializer__add_leaf(context,
+ (const void * const *)&merges.range_counts,
+ merges.count * sizeof(*merges.range_counts));
/* ranges */
- svn_temp_serializer__push(context,
- (const void * const *)&merges.ranges,
- range_count * sizeof(*merges.ranges));
- svn_temp_serializer__pop(context);
+ svn_temp_serializer__add_leaf(context,
+ (const void * const *)&merges.ranges,
+ range_count * sizeof(*merges.ranges));
/* return the serialized result */
serialized = svn_temp_serializer__get(context);
Modified: subversion/trunk/subversion/libsvn_subr/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/temp_serializer.c?rev=1505056&r1=1505055&r2=1505056&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/temp_serializer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/temp_serializer.c Fri Jul 19 22:32:06 2013
@@ -279,6 +279,26 @@ svn_temp_serializer__pop(svn_temp_serial
context->recycler = old;
}
+void
+svn_temp_serializer__add_leaf(svn_temp_serializer__context_t *context,
+ const void * const * source_struct,
+ apr_size_t struct_size)
+{
+ const void *source = *source_struct;
+
+ /* the serialized structure must be properly aligned */
+ if (source)
+ align_buffer_end(context);
+
+ /* Store the offset at which the struct data that will the appended.
+ * Write 0 for NULL pointers. */
+ store_current_end_pointer(context, source_struct);
+
+ /* finally, actually append the struct contents */
+ if (*source_struct)
+ svn_stringbuf_appendbytes(context->buffer, source, struct_size);
+}
+
/* Serialize a string referenced from the current structure within the
* serialization CONTEXT. S must be a reference to the char* pointer in
* the original structure so that the correspondence in the serialized