File: tree.ml

package info (click to toggle)
ocaml-benchmark 1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: ml: 1,114; makefile: 45; perl: 12
file content (22 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let () =
  let open Benchmark.Tree in
  "" @> lazy (let create() = Array.init 1_000_000 (fun i -> i) in
              Benchmark.latency1 18L create () )
  |> register;

  "map" @> lazy (let a = Array.init 1_000_000 (fun i -> i) in
                 let f x = x + 1 in
                 Benchmark.latency1 18L (Array.map f) a )
  |> register;

  "sort"
  @> lazy (let a = Array.init 1_000_000 (fun i -> -i) in
           Benchmark.latency1 18L (Array.sort compare) a )
 |> register;

  "sort.add"
  @> lazy (Benchmark.latency1 18L (fun x -> x + 1) 1)
  |> register

let () =
  Benchmark.Tree.run_global ()