Skip to content

Instantly share code, notes, and snippets.

@kgadek kgadek/harrop_ghc.hs
Last active Feb 11, 2017

Embed
What would you like to do?
-- stack --resolver nightly-2017-02-08 ghc --package hashtables -- -O2 harrop_ghc.hs
import Control.Monad
import qualified Data.HashTable.IO as H
type HashTable k v = H.BasicHashTable k v
main = do
m <- H.new :: IO (HashTable Int Int)
forM_ [1..10000000] $ \n -> H.insert m n n
v <- H.lookup m 100
print v
(* ocamlopt -o harrop_ocaml harrop_ocaml.ml *)
let n = 10000000
let () =
let m = Hashtbl.create n in
for n=1 to n do
Hashtbl.add m n n
done;
Printf.printf "%d\n%!" (Hashtbl.find m 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.