Skip to content

Instantly share code, notes, and snippets.

@jh3141
jh3141 / CuckooChameleon.hs
Created Apr 1, 2016
A function for testing insert/lookup times of cuckoo hash table with pathological data.
View CuckooChameleon.hs
import Data.Hashable
import Control.Monad.ST
import qualified Data.HashTable.ST.Cuckoo as HT
data HashCollider = HashCollider String Int
deriving (Eq, Show)
instance Hashable HashCollider where
hashWithSalt salt (HashCollider name value) = salt + value
View Makefile
all: benchmark
benchmark: test-c test-clang test-g++ test-clang++ test.js test.lua
@echo "Benchmark updated at `date`" > benchmark
@echo >> benchmark
@echo '--- time ./test-c' >> benchmark
@time ./test-c >> benchmark 2>&1
@echo >> benchmark
@echo '--- time ./test-clang' >> benchmark
@time ./test-clang >> benchmark 2>&1
You can’t perform that action at this time.