Browse Source

Use Core_bench now (Getting Error)

Error is:

    Uncaught exception:

      (Invalid_argument
       "Float.iround_towards_zero_exn: argument (1548768043.518066) is out of range or NaN")

    Raised at file "pervasives.ml", line 31, characters 25-45
    Called from file "src/benchmark.ml", line 94, characters 19-110
    Called from file "src/core_list.ml", line 405, characters 13-17
    Called from file "src/bench.ml", line 40, characters 21-46
    Called from file "src/command.ml", line 1877, characters 6-97
    Called from file "src/exn.ml", line 88, characters 6-10
Leo 9 years ago
parent
commit
5854116b34
1 changed files with 4 additions and 18 deletions
  1. 4 18
      bench/swap.ml

+ 4 - 18
bench/swap.ml

@@ -35,7 +35,7 @@
 (******************************************************************************)
 (******************************************************************************)
 
 
 open Core.Std
 open Core.Std
-(*open Core_bench.Std*)
+open Core_bench.Std
 
 
 (* File to test who is the faster to swap two elements *)
 (* File to test who is the faster to swap two elements *)
 (* TODO:
 (* TODO:
@@ -136,21 +136,7 @@ let tests = [
   "Once - big once", (fun () -> once big_data a'' b'');
   "Once - big once", (fun () -> once big_data a'' b'');
 ]
 ]
 
 
-(*let () =*)
-  (*List.map tests ~f:(fun (name,test) -> Bench.Test.create ~name test)*)
-  (*|> Bench.make_command*)
-  (*|> Command.run*)
-
-(* Manual way to test, it don't have core_bench yet *)
-let man_run f =
-  let open Time in
-  let start = now () in
-  let i = f () in
-  let stop = now () in
-  diff stop start |> Core.Span.to_string
-;;
-
 let () =
 let () =
-  List.map tests ~f:(fun (name,test) -> ( name, man_run test ))
-  |> List.iter ~f:(fun ( name, duration ) -> printf "%s: %s\n" name duration)
-
+  List.map tests ~f:(fun (name,test) -> Bench.Test.create ~name test)
+  |> Bench.make_command
+  |> Command.run