summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c10ed33)
My simple test program on my laptop showed that with modern 32 bit Intel
CPUs and modern GCC, there's no measurable penalty for the clean version.
Andrew Bartlett complained that the valgrind noise was grating. Agreed.
u.ptr = key;
if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
u.ptr = key;
if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
* does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash
* noticably faster for short strings (like English words).
* does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash
* noticably faster for short strings (like English words).
+ *
+ * Not on my testing with gcc 4.5 on an intel i5 CPU, at least --RR.
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
u.ptr = key;
if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
u.ptr = key;
if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
* does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash
* noticably faster for short strings (like English words).
* does it on word boundaries, so is OK with this. But VALGRIND will
* still catch it and complain. The masking trick does make the hash
* noticably faster for short strings (like English words).
+ *
+ * Not on my testing with gcc 4.5 on an intel i5 CPU, at least --RR.
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
switch(length)
{
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
* Author: Rusty Russell
*
* License: LGPLv3 (or later)
* Author: Rusty Russell
*
* License: LGPLv3 (or later)
- *
- * Ccanlint:
- * // hash fails because it accesses data in 4 byte quantities for speed.
- * tests_pass_valgrind --partial-loads-ok=yes
*/
int main(int argc, char *argv[])
{
*/
int main(int argc, char *argv[])
{