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/05/27 12:56:55 UTC

svn commit: r1681965 - /subversion/branches/1.10-cache-improvements/subversion/libsvn_subr/cache-membuffer.c

Author: stefan2
Date: Wed May 27 10:56:54 2015
New Revision: 1681965

URL: http://svn.apache.org/r1681965
Log:
On the 1.10-cache-improvement branch:

* subversion/libsvn_subr/cache-membuffer.c
  (combine_key): Explain how important reversibility is on this optimized
                 code path.  No functional change.

Modified:
    subversion/branches/1.10-cache-improvements/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/branches/1.10-cache-improvements/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.10-cache-improvements/subversion/libsvn_subr/cache-membuffer.c?rev=1681965&r1=1681964&r2=1681965&view=diff
==============================================================================
--- subversion/branches/1.10-cache-improvements/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/1.10-cache-improvements/subversion/libsvn_subr/cache-membuffer.c Wed May 27 10:56:54 2015
@@ -2887,15 +2887,18 @@ combine_key(svn_membuffer_cache_t *cache
    * to prevent key collisions.  So, we limit ourselves to xor and
    * permutations.
    *
-   * As long as we compare the full combined key, the additional
-   * fingerprint collisions introduced by a non-reversible scramble
-   * would simply reduce the cache effectiveness.
+   * Since the entry key must preserve the full key (prefix and KEY),
+   * the scramble must not introduce KEY collisions.
    */
   data[1] = (data[1] << 27) | (data[1] >> 37);
   data[1] ^= data[0] & 0xffff;
   data[0] ^= data[1] & APR_UINT64_C(0xffffffffffff0000);
 
-  /* combine with this cache's namespace */
+  /* Combine with this cache's prefix.  This is reversible because the
+   * prefix is known through to the respective entry_key element.  So,
+   * knowing entry_key.prefix_id, we can still reconstruct KEY (and the
+   * prefix key).
+   */
   cache->combined_key.entry_key.fingerprint[0]
     = data[0] ^ cache->prefix.fingerprint[0];
   cache->combined_key.entry_key.fingerprint[1]