Page 1 of 1

Compiling firmware with Linaro slightly improves performance

Posted: Tue May 13, 2014 5:11 pm
by SkG
There was one thing in my mind that I wanted to do as soon as I get my pyboard and that was check if Linaro GCC increase the performance.

I used as abase the "benchmark" that is in the wiki: https://github.com/micropython/micropyt ... erformance

I put the following code in boot.py and then via serial console I ran benchmark():

Code: Select all

def performanceTest():
    millis = pyb.millis
    endTime = millis() + 10000
    count = 0
    while millis() < endTime:
        count += 1
    return count

def benchmark():
    c = 0
    for i in range(10):
        c += performanceTest()
    c = c/10
    print("Avg. Count: ", c)
With the "stock" firmware I got an avg of: 2117312
With the same version (git checkout v1.0) compiled with Linaro GCC 4.8 2014.01 I got an avg of: 2152395

That is 35083 iterations more. What do you think, It worth the difference? Anyone can suggest a proper benchmark?

Re: Compiling firmware with Linaro slightly improves perform

Posted: Wed May 14, 2014 8:04 pm
by SkG
Seems that v1.0.1 runs a little bit faster, here the results with the same test:

GNU GCC 4.8: 2176580
Linaro GCC 4.8 2014.01: 2236090

Re: Compiling firmware with Linaro slightly improves perform

Posted: Fri May 23, 2014 9:04 pm
by davidb24v
Thanks for this. It gave me an excuse to try out one of the "emitters".

With latest firmware (as of about 10 minutes ago) your benchmark gave me:
Avg. Count: 2.14166e+06
I then just added the "@micropython.native" decorator and re-pasted your performanceTest function and got:
Avg. Count: 4.06494e+06
Ok, so it's not a "real world" example, whatever. It's not even a factor of two.

However, if I can get "not even a factor of two" with a decorator then I'm impressed. Very impressed ;)