From 52e4a9092ab6c85397f59cd9c96c4e51f9c15224 Mon Sep 17 00:00:00 2001 From: Jon Hylands Date: Wed, 29 Jan 2014 15:43:29 -0800 Subject: [PATCH] Updated Performance (markdown) --- Performance.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Performance.md b/Performance.md index be82a2a..ba674d4 100644 --- a/Performance.md +++ b/Performance.md @@ -1,14 +1,17 @@ Here's a sample little tight counter loop, running for 10 seconds on 3 different setups: **MicroPython on Teensy 3.1: (96Mhz ARM)** +Damien gave me a hint, and told me to put the performance test inside a function, rather than global. It almost doubles the execution speed, which used to run 396,505 times. - endTime = pyb.millis() + 10000 - count = 0 - while pyb.millis() < endTime: - count += 1 - print("Count: ", count) + def performanceTest(): + endTime = pyb.millis() + 10000 + count = 0 + while pyb.millis() < endTime: + count += 1 + print("Count: ", count) + performanceTest() -**Count: 396,505** +**Count: 659,770** ***