diff --git a/src/backends/packrat.c b/src/backends/packrat.c
index c5c9565f272caab47aeab2f59592bf93dd40d524..8aa1f8ed670502f4b59e9be6498d22eaa74723ad 100644
--- a/src/backends/packrat.c
+++ b/src/backends/packrat.c
@@ -3,14 +3,6 @@
 #include "../internal.h"
 #include "../parsers/parser_internal.h"
 
-static uint32_t djbhash(const uint8_t *buf, size_t len) {
-  uint32_t hash = 5381;
-  while (len--) {
-    hash = hash * 33 + *buf++;
-  }
-  return hash;
-}
-
 // short-hand for constructing HCachedResult's
 static HCachedResult *cached_result(const HParseState *state, HParseResult *result) {
   HCachedResult *ret = a_new(HCachedResult, 1);
@@ -214,7 +206,7 @@ void h_packrat_free(HParser *parser) {
 }
 
 static uint32_t cache_key_hash(const void* key) {
-  return djbhash(key, sizeof(HParserCacheKey));
+  return h_djbhash(key, sizeof(HParserCacheKey));
 }
 static bool cache_key_equal(const void* key1, const void* key2) {
   return memcmp(key1, key2, sizeof(HParserCacheKey)) == 0;
diff --git a/src/datastructures.c b/src/datastructures.c
index bd9b4ebefb4e8069a983e153decb0e3059737af6..730c6b99ddb375ee07a091183f4473e7fd0dd0ef 100644
--- a/src/datastructures.c
+++ b/src/datastructures.c
@@ -329,6 +329,15 @@ bool h_eq_ptr(const void *p, const void *q) {
 }
 
 HHashValue h_hash_ptr(const void *p) {
-  // XXX just djbhash it
+  // XXX just djbhash it? it does make the benchmark ~7% slower.
+  //return h_djbhash((const uint8_t *)&p, sizeof(void *));
   return (uintptr_t)p >> 4;
 }
+
+uint32_t h_djbhash(const uint8_t *buf, size_t len) {
+  uint32_t hash = 5381;
+  while (len--) {
+    hash = hash * 33 + *buf++;
+  }
+  return hash;
+}
diff --git a/src/internal.h b/src/internal.h
index 11836826c9771ed8d46302ec8c4f118ce14fac0f..2f3018df2aebe3e61b2af74c3b4b5a70997211f2 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -276,6 +276,7 @@ bool h_hashset_equal(const HHashSet *a, const HHashSet *b);
 
 bool h_eq_ptr(const void *p, const void *q);
 HHashValue h_hash_ptr(const void *p);
+uint32_t h_djbhash(const uint8_t *buf, size_t len);
 
 typedef struct HCFSequence_ HCFSequence;