diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-05 01:24:16 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-05 01:24:16 +0300 |
commit | aaff82afe5a72ec69e05f1e56047d0acfde91d0e (patch) | |
tree | 7bd8dc3cf156b790b66c05b2222bd362bdbce3d8 /tests/bench/var-3-local.py | |
parent | 22a0d67c0fc7daf18280d3b7e938be8442102110 (diff) | |
download | micropython-aaff82afe5a72ec69e05f1e56047d0acfde91d0e.tar.gz micropython-aaff82afe5a72ec69e05f1e56047d0acfde91d0e.zip |
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.
Diffstat (limited to 'tests/bench/var-3-local.py')
-rw-r--r-- | tests/bench/var-3-local.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/bench/var-3-local.py b/tests/bench/var-3-local.py new file mode 100644 index 0000000000..124b484295 --- /dev/null +++ b/tests/bench/var-3-local.py @@ -0,0 +1,10 @@ +import bench + + +def test(num): + ITERS = 20000000 + i = 0 + while i < ITERS: + i += 1 + +bench.run(test) |