Simple Performance Timing


I was making some performance measurements on a Panda, comparing performance running under Visual Studio, and running standalone. The code is very simple:

    public class Program
        public static void Main()
            Boolean val = false;
            OutputPort port = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di0, false);

            while (true)
                val = !val;

When I run the code in the debugger, it makes a nice ~8.1 kHz square wave, meaning we are executing the while loop at a little over 16 kHz. Running standalone showed a slight improvement (around 8.2 kHz square wave).

Is this in the ballpark for what I should expect in performance?


Toggling an pin is a very bad way of testing performance. Your test shows that FEZ runs at half speed when it is connected to debugger but that is NOT the case! It does run slower when debugger is attached, maybe 5% slower but defiantly not half speed.


You may find this thread interesting:

Thanks for the link to the thread Architect. I guess that’s the kind of information I was looking for.

And Gus, maybe I didn’t write my post very well, but my tests showed exactly what you pointed out. Running without the debugger produced a slight improvement, not double. The square wave frequency changed from 8.1 to 8.2 kHz (roughly). The 16 kHz number is how fast I’m actually getting through the loop (1 loop per state change).