subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1681960 - /subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
Date Wed, 27 May 2015 10:40:45 GMT
Author: stefan2
Date: Wed May 27 10:40:45 2015
New Revision: 1681960

URL: http://svn.apache.org/r1681960
Log:
* subversion/libsvn_subr/cache-membuffer.c
  (combine_key): Explain the rationale behind scrambling keys reversibly.
                 No functional change.

Suggested by: stsp

Modified:
    subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-membuffer.c?rev=1681960&r1=1681959&r2=1681960&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Wed May 27 10:40:45 2015
@@ -2670,8 +2670,15 @@ combine_key(svn_membuffer_cache_t *cache
       data[1] = 0;
       memcpy(data, key, key_len);
 
-      /* scramble key DATA.  All of this must be reversible to prevent key
-       * collisions.  So, we limit ourselves to xor and permutations. */
+      /* Scramble key DATA to spread the key space more evenly across the
+       * cache segments and entry buckets.  All of this shall be reversible
+       * 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.
+       */
       data[1] = (data[1] << 27) | (data[1] >> 37);
       data[1] ^= data[0] & 0xffff;
       data[0] ^= data[1] & APR_UINT64_C(0xffffffffffff0000);



Mime
View raw message