Commit cc8c8a7e authored by John Zhang's avatar John Zhang

include slowdown in result dictionary

parent 27013485
...@@ -139,11 +139,12 @@ def get_stat_compiled(compile_fnc, config, iterations=100): ...@@ -139,11 +139,12 @@ def get_stat_compiled(compile_fnc, config, iterations=100):
def get_display_str(stat): def get_display_str(stat):
output = "average: %(average)s\n" \ output = "average: {average:.6f}\n" \
"min: %(t_min)s\n" \ "min: {t_min:.6f}\n" \
"max: %(t_max)s\n" \ "max: {t_max:.6f}\n" \
"std_dev: %(std_dev)s\n" "std_dev: {std_dev:.6f}\n" \
return output % stat "slowdown: {slowdown:.3f}x\n"
return output.format(**stat)
def perf(config, iterations): def perf(config, iterations):
...@@ -158,6 +159,10 @@ def perf(config, iterations): ...@@ -158,6 +159,10 @@ def perf(config, iterations):
if config['mu_build_fnc']: if config['mu_build_fnc']:
results['mu'] = get_stat_compiled(compile_mu, config, iterations) results['mu'] = get_stat_compiled(compile_mu, config, iterations)
baseline_target = 'c'
for python, result in results.items():
result['slowdown'] = result['average'] / results[baseline_target]['average']
for python, result in results.items(): for python, result in results.items():
print '\033[35m---- %(python)s ----\033[0m' % locals() print '\033[35m---- %(python)s ----\033[0m' % locals()
print get_display_str(result) print get_display_str(result)
...@@ -269,15 +274,15 @@ def perf_quicksort(N, iterations): ...@@ -269,15 +274,15 @@ def perf_quicksort(N, iterations):
def test_functional_fibonacci(): def test_functional_fibonacci():
save_results('fibonacci', perf_fibonacci(5, 1)) perf_fibonacci(5, 1)
def test_functional_arraysum(): def test_functional_arraysum():
save_results('arraysum', perf_arraysum(100, 1)) perf_arraysum(100, 1)
def test_functional_quicksort(): def test_functional_quicksort():
save_results('quicksort', perf_quicksort(100, 5)) perf_quicksort(100, 5)
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment