Skip to content

Commit 91a4a93

Browse files
authored
Merge pull request #118 from splitio/improvement/new_hash_implementation
Improvement/new hash implementation
2 parents a45dbab + 1183a63 commit 91a4a93

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
'test': tests_require,
3636
'redis': ['redis>=2.10.5', 'jsonpickle>=0.9.3'],
3737
'uwsgi': ['uwsgi>=2.0.0', 'jsonpickle>=0.9.3'],
38-
'cpphash': ['splitmmh3']
38+
'cpphash': ['mmh3cffi']
3939
},
4040
setup_requires=['nose'],
4141
classifiers=[

splitio/hashfns/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111

1212
try:
1313
# First attempt to import module with C++ core (faster)
14-
import mmh3
15-
from ctypes import c_uint
14+
import mmh3cffi
1615

1716
def _murmur_hash(key, seed):
18-
ukey = key.encode('utf8')
19-
return c_uint(mmh3.hash(ukey, seed)).value
17+
return mmh3cffi.hash_str(key, seed)
2018
except:
2119
# Fallback to interpreted python hash algoritm (slower)
2220
from splitio.hashfns import murmur3py

0 commit comments

Comments
 (0)