Created
September 7, 2018 12:46
-
-
Save hoichi/eb30b2393168500ba00abe940fdaa09f to your computer and use it in GitHub Desktop.
Benchmarking in OCaml
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
#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