diff --git a/enable/gcbench/bench.py b/enable/gcbench/bench.py index 675d5bffe..b87d38374 100644 --- a/enable/gcbench/bench.py +++ b/enable/gcbench/bench.py @@ -122,9 +122,9 @@ def gen_timings(gc, func): times = np.array(times) return { - "max": times.max() * 1000, - "min": times.min() * 1000, "mean": times.mean() * 1000, + "min": times.min() * 1000, + "max": times.max() * 1000, "std": times.std() * 1000, "count": len(times), } diff --git a/enable/gcbench/publish.py b/enable/gcbench/publish.py index 29262b68e..bad6ed95d 100644 --- a/enable/gcbench/publish.py +++ b/enable/gcbench/publish.py @@ -7,10 +7,9 @@ # is also available online at http://www.enthought.com/licenses/BSD.txt # # Thanks for using Enthought open source! -import math import os -_DOC_TEMPLATE = """ +_INDEX_TEMPLATE = """
@@ -40,7 +39,30 @@ All results are shown relative to the kiva.agg backend. Numbers less than 1.0 indicate a slower result and numbers greater than 1.0 indicate a faster result. -{content} +{comparison_table} + + +""" +_IMAGE_PAGE_TEMPLATE = """ + + + + ++Results for the "{benchmark_name}" benchmark. All times are in milliseconds. +
+{image_table} """ @@ -61,28 +83,30 @@ def publish(results, outdir): functions = {} for bend in backends: for func, stats in results[bend].items(): - value = stats["mean"] if stats is not None else math.nan - functions.setdefault(func, {})[bend] = value - - # Scale timing values relative to a "baseline" backend implementation - for name in functions.keys(): - functions[name] = _format_stats(functions[name], name, "kiva.agg") + functions.setdefault(func, {})[bend] = stats - table = _build_table(backends, functions) + # Scale timing values relative to the "kiva.agg" backend implementation + comparisons = {} + for name, results in functions.items(): + _build_function_page(name, results, outdir) + comparisons[name] = _format_mean(results, "kiva.agg") + comparison_table = _build_comparison_table(backends, comparisons) path = os.path.join(outdir, "index.html") with open(path, "w") as fp: - fp.write(_DOC_TEMPLATE.format(content=table)) + fp.write(_INDEX_TEMPLATE.format(comparison_table=comparison_table)) -def _build_table(backends, functions): - """ Build some table data +def _build_comparison_table(backends, comparisons): + """ Build some table data for comparison of backend performance timings. """ # All the row data rows = [] - for name, stats in functions.items(): + for name, stats in comparisons.items(): # Start the row off with the name of the function - row = [f"
Timings: