This website requires JavaScript.
Explore
Help
Sign In
djsundog
/
circuitpython
Watch
1
Star
0
Fork
0
You've already forked circuitpython
Code
Issues
Pull Requests
Packages
Projects
Releases
Wiki
Activity
a708848b0c
circuitpython
/
tests
/
internal_bench
/
bench.py
12 lines
115 B
Python
Raw
Normal View
History
Unescape
Escape
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.
2014-05-04 18:24:16 -04:00
import
time
ITERS
=
20000000
tests: Format all Python code with black, except tests in basics subdir. This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
2020-03-22 22:26:08 -04:00
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.
2014-05-04 18:24:16 -04:00
def
run
(
f
)
:
t
=
time
.
time
(
)
f
(
ITERS
)
t
=
time
.
time
(
)
-
t
print
(
t
)
Reference in New Issue
Copy Permalink