Author: stefan2
Date: Sat May 19 23:07:59 2012
New Revision: 1340590
URL: http://svn.apache.org/viewvc?rev=1340590&view=rev
Log:
Drop svn_hash__make_fast() as it will only be faster when the
key size is known in advance. That is rarely the case in our code.
* subversion/include/private/svn_subr_private.h
(svn_hash__make_fast): drop
* subversion/libsvn_subr/hash.c
(LOWER_7BITS_SET, BIT_7_SET, READ_CHUNK, hashfunc_fast,
svn_hash__make_fast): drop
Modified:
subversion/trunk/subversion/include/private/svn_subr_private.h
subversion/trunk/subversion/libsvn_subr/hash.c
Modified: subversion/trunk/subversion/include/private/svn_subr_private.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_subr_private.h?rev=1340590&r1=1340589&r2=1340590&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_subr_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_subr_private.h Sat May 19
23:07:59 2012
@@ -291,15 +291,6 @@ svn_hash__get_bool(apr_hash_t *hash,
apr_hash_t *
svn_hash__make(apr_pool_t *pool);
-/** Returns a hash table, allocated in @a pool, that is faster to modify
- * and access then the ones returned by @ref svn_hash__make. The element
- * order does not match any APR default and is platform dependent.
- *
- * @since New in 1.8.
- */
-apr_hash_t *
-svn_hash__make_fast(apr_pool_t *pool);
-
/** @} */
/** @} */
Modified: subversion/trunk/subversion/libsvn_subr/hash.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/hash.c?rev=1340590&r1=1340589&r2=1340590&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/hash.c (original)
+++ subversion/trunk/subversion/libsvn_subr/hash.c Sat May 19 23:07:59 2012
@@ -563,7 +563,7 @@ svn_hash__get_bool(apr_hash_t *hash, con
-/*** Optimized hash functions ***/
+/*** Optimized hash function ***/
/* Optimized version of apr_hashfunc_default. It assumes that the CPU has
* 32-bit multiplications with high throughput of at least 1 operation
@@ -614,77 +614,8 @@ hashfunc_compatible(const char *char_key
return hash;
}
-/* Used to detect NUL chars
- */
-#define LOWER_7BITS_SET 0x7f7f7f7f
-#define BIT_7_SET 0x80808080
-
-/* Read 4 bytes at P. LE / BE interpretation is platform-dependent
- */
-#if SVN_UNALIGNED_ACCESS_IS_OK
-# define READ_CHUNK(p) *(const apr_uint32_t *)(p)
-#else
-# define READ_CHUNK(p) \
- ( (apr_uint32_t)p[0] \
- + ((apr_uint32_t)p[1] << 8) \
- + ((apr_uint32_t)p[2] << 16) \
- + ((apr_uint32_t)p[3] << 24))
-#endif
-
-/* Similar to the previous but operates on 4 bytes at once instead of the
- * classic unroll. This is particularly fast when unaligned access is
- * supported.
- */
-static unsigned int
-hashfunc_fast(const char *char_key, apr_ssize_t *klen)
-{
- unsigned int hash = 0;
- const unsigned char *key = (const unsigned char *)char_key;
- const unsigned char *p;
- apr_ssize_t i;
- apr_uint32_t chunk, test;
-
- if (*klen == APR_HASH_KEY_STRING)
- {
- for (p = key; ; p += sizeof(chunk))
- {
- /* This is a variant of the well-known strlen test: */
- chunk = READ_CHUNK(p);
- test = chunk | ((chunk & LOWER_7BITS_SET) + LOWER_7BITS_SET);
- if ((test & BIT_7_SET) != BIT_7_SET)
- break;
-
- hash = (hash + chunk) * 0xd1f3da69;
- }
- for (; *p; p++)
- hash = hash * 33 + *p;
-
- *klen = p - key;
- }
- else
- {
- for ( p = key, i = *klen
- ; i >= sizeof(chunk)
- ; i -= sizeof(chunk), p += sizeof(chunk))
- {
- chunk = READ_CHUNK(p);
- hash = (hash + chunk) * 0xd1f3da69;
- }
- for (; i; i--, p++)
- hash = hash * 33 + *p;
- }
-
- return hash;
-}
-
apr_hash_t *
svn_hash__make(apr_pool_t *pool)
{
return apr_hash_make_custom(pool, hashfunc_compatible);
}
-
-apr_hash_t *
-svn_hash__make_fast(apr_pool_t *pool)
-{
- return apr_hash_make_custom(pool, hashfunc_fast);
-}