From aaff82afe5a72ec69e05f1e56047d0acfde91d0e Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 5 May 2014 01:24:16 +0300 Subject: tests: Add framework for comparative benchmarking. Motivation is optimizing handling of various constructs as well as understanding which constructs are more efficient in MicroPython. More info: http://forum.micropython.org/viewtopic.php?f=3&t=77 Results are wildly unexpected. For example, "optimization" of range iteration into while loop makes it twice as slow. Generally, the more bytecodes, the slower the code. --- tests/bench/var-2-global.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/bench/var-2-global.py (limited to 'tests/bench/var-2-global.py') diff --git a/tests/bench/var-2-global.py b/tests/bench/var-2-global.py new file mode 100644 index 000000000..5758ad61a --- /dev/null +++ b/tests/bench/var-2-global.py @@ -0,0 +1,10 @@ +import bench + +ITERS = 20000000 + +def test(num): + i = 0 + while i < ITERS: + i += 1 + +bench.run(test) -- cgit v1.2.3