Last active
February 11, 2017 14:44
-
-
Save kgadek/515e9c36bc79706cba3f5dcdc350fcbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* 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