Skip to content

Instantly share code, notes, and snippets.

@hoichi
Created September 7, 2018 12:46
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 hoichi/eb30b2393168500ba00abe940fdaa09f to your computer and use it in GitHub Desktop.
Save hoichi/eb30b2393168500ba00abe940fdaa09f to your computer and use it in GitHub Desktop.
Benchmarking in OCaml
#require "core_bench";;
open Core_bench;;
[ Bench.Test.create ~let numbers = List.range 0 1000 in
[ Bench.Test.create ~name:"sum_if" (fun () -> ignore (sum_if numbers))
; Bench.Test.create ~name:"sum" (fun () -> ignore (sum numbers)) ]
|> Bench.bench
;;
(* from https://dev.realworldocaml.org/lists-and-patterns.html#performance *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment