mirage / bechamel

Agnostic benchmark in OCaml (proof-of-concept)
MIT License
44 stars 15 forks source link

Add bechamel-html #4

Closed Julow closed 4 years ago

Julow commented 4 years ago

This adds the binary bechamel-html.

It takes the JSON output of Bechamel_js.emit as stdin and outputs a standalone HTML file to visualize it. That HTML file is html/index.html, this PR only adds a way to make it standalone.

This is how I use it:

(rule
 (targets output.json)
 (action
  (with-stdout-to %{targets}
   (run ./bench.exe))))

(rule
 (targets output.html)
 (action
  (system "%{bin:bechamel-html} < %{dep:output.json} > %{targets}")))

; To promote HTML output to project directory
; Make sure that `bench_result.html` exists
; Run like `dune build @bench --auto-promote`
(alias
 (name bench)
 (action (cmp ../bench_result.html %{dep:output.html})))

This is WIP because the code is ugly and there is no test.

dinosaure commented 4 years ago

I'm ok with this way :+1:.

dinosaure commented 4 years ago

About tests, the only part where we should have test is about string_find. But it's fine if we have nothing. It still be a small tool. Just to put the failwith and I'm ready to merge it.

Julow commented 4 years ago

I just added a blackbox test, should be enough for now.

dinosaure commented 4 years ago

Thanks!