Skip to content

Instantly share code, notes, and snippets.

@kgadek
Last active February 11, 2017 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgadek/515e9c36bc79706cba3f5dcdc350fcbe to your computer and use it in GitHub Desktop.
Save kgadek/515e9c36bc79706cba3f5dcdc350fcbe to your computer and use it in GitHub Desktop.
-- 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