./wip/ocaml-pa_bench, Syntax extension for inline benchmarks

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 112.06.00, Package name: ocaml-pa_bench-112.06.00, Maintainer: pkgsrc-users

Pa_bench is a syntax extension that helps writing inline benchmarks.


Required to run:
[lang/ocaml] [devel/ocaml-findlib] [devel/ocaml-type_conv]

Master sites:


Version history: (Expand)


CVS history: (Expand)


   2015-02-26 17:02:45 by Hiramatsu Yoshifumi | Files touched by this commit (3) | Package updated
Log message:
Update ocaml-pa_bench to 112.06.00.

Changes from previous:
----------------------
- Made the code generated by `pa_bench` for `BENCH` not use `ignore`,
  because OCaml 4.02 will remove dead code in some cases, meaning the
  benchmarks are no longer measuring what they should.  Instead the ignore
  is deep inside `Core_bench`, which is likely out of reach of the
  compiler.

    The result of the user functions given to `BENCH_FUN` and
    `BENCH_INDEXED` are changed so they don't have to return unit and
    people are encouraged not to use `ignore` when these functions don't
    return `unit` (you will get the same warning though, i.e. a warning
    if the result of your function is a function too, thus preventing
    unintended partial applications).

    For example, here are a few benchmarks and their output before the
    fix:

        let x = if Random.bool () then 100 else 1001
        let r = ref 0
        BENCH "ig-1" = 10 / x
        BENCH "ig-2" = ()
        BENCH "ig-3" = phys_equal (10 / x) (Obj.magic 0)
        BENCH "ig-4" = r := (10 / x)
        BENCH "ig-5" = r := x

        +----------------+----------+------------+
        | Name           | Time/Run | Percentage |
        +----------------+----------+------------+
        | [misc.ml] ig-1 |   3.92ns |     29.30% |
        | [misc.ml] ig-2 |   3.34ns |     24.95% |
        | [misc.ml] ig-3 |   3.91ns |     29.23% |
        | [misc.ml] ig-4 |  13.37ns |    100.00% |
        | [misc.ml] ig-5 |   3.24ns |     24.20% |
        +----------------+----------+------------+

    Many of the the numbers above are much lower than they should be
    because of the implicit ignores inserted by the benchmark caused the
    division to to eliminated by the compiler. After the fix, the same
    benchmarks produced more meaningful numbers:

        +----------------+----------+------------+
        | Name           | Time/Run | Percentage |
        +----------------+----------+------------+
        | [misc.ml] ig-1 |  12.78ns |     94.55% |
        | [misc.ml] ig-2 |   3.23ns |     23.90% |
        | [misc.ml] ig-3 |  13.51ns |     99.94% |
        | [misc.ml] ig-4 |  13.52ns |    100.00% |
        | [misc.ml] ig-5 |   3.30ns |     24.40% |
        +----------------+----------+------------+
   2015-02-12 09:02:01 by Hiramatsu Yoshifumi | Files touched by this commit (5)
Log message:
Add OCaml library pa_bench into wip/ocaml-pa_bench.

Pa_bench is a syntax extension that helps writing inline benchmarks.