libnonius / nonius

A C++ micro-benchmarking framework
https://nonius.io
Creative Commons Zero v1.0 Universal
358 stars 47 forks source link

Fix bad data on html report summary page #109

Open jtippet opened 4 years ago

jtippet commented 4 years ago

The HTML report's Javascript incorrectly assumes that the benchmarks in each run are sorted in the same order. That's not the case (maybe it should be?). Instead, you can often have something like this:

var data = { runs: [
    { benchmarks: [ { name: 'a', mean: 1 }, { name: 'b', mean: 2 } ] },
    { benchmarks: [ { name: 'b', mean: 3 }, { name: 'a', mean: 4 } ] },
]};

In the above example, the summary plot would assume that the first benchmark is named 'a', and it would draw a line for series 'a' connecting points [1, 3]. It should instead draw a line connecting points [1, 4].

This change updates the javascript to search all the runs in the benchmark for one with the target name.

Fixes #108.