IMHO you are not right here, breakpoint checking has to be present in the release [firmware] build - this is the one that is published, without breakpoints you would not be able to debug the application (from Visual Studio). Perhaps the overhead should only take place when a debugger is attached (if it is not done so already).
I would be interested in you measurement results of a 'RTM' build (compiled with /p:Flavor=RTM option) that has debugging disabled (and "some CLR diagnostic functionality may be eliminated").
Below are images form my logic analyzer screen shots. The code is below the images.
Three runs are shown here:
First run is with release code:
It takes 51.9 uS to toggle the output D1
It takes 59.6 uS to toggle the output D1 with the line k=i; in the middle.
So takes ~7.7 uS to execute code k=i;
Second run is debug no breakpoint set:
It takes 53.4 uS to toggle the output D1
It takes 60.9 uS to toggle the output D1 with the line k=i; in the middle.
So takes ~7.5 uS to execute code k=i;
Third run is debug code with break point on line k=0;
It takes 83.9 uS to toggle the output D1
It takes 103.9 uS to toggle the output D1 with the line k=i; in the middle.
So takes ~20.0 uS to execute code k=i;
public static void Main()
bool ledState = false;
OutputPort A1 = new OutputPort(Pins.GPIO_PIN_D1, false);
OutputPort led = new OutputPort(Pins.ONBOARD_LED, ledState);
for (i = 0; i < 1000; i++)
ledState = !ledState;
k = i;
k = k + 1;
i = k; }