Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

netduino/MF performance


  • Please log in to reply
24 replies to this topic

#21 Daman

Daman

    New Member

  • Members
  • Pip
  • 5 posts

Posted 26 March 2011 - 09:03 PM

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;


Posted Image

Posted Image

Posted Image

public static void Main()
{

bool ledState = false;
OutputPort A1 = new OutputPort(Pins.GPIO_PIN_D1, false);
OutputPort led = new OutputPort(Pins.ONBOARD_LED, ledState);

int i;
int k=0;
for (i = 0; i < 1000; i++)
{

ledState = !ledState;
led.Write(ledState);

A1.Write(true);
A1.Write(false);
A1.Write(true);
k = i;
A1.Write(false);
Thread.Sleep(2000);
k = k + 1;

}
i = k;

}

#22 BitFlipper

BitFlipper

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts

Posted 26 May 2011 - 06:03 PM

The modulus operator "%" results in a floating point division operation. At least this is true on the full .Net, so I assume it is true on MF too. And since there isn't native floating point support, this can be really slow. There are other ways to calculate the remainder other than using the modulus operator. But I agree, MF seems really slow. I wonder how hard it would be to create a post-build IL-to-native compiler. And if the problem is that the code is much larger (I read in another thread it is 10x larger), maybe there should be a way to compile just methods marked with a specific attribute so that the developer can choose which methods to compile.

#23 Corey Kosak

Corey Kosak

    Advanced Member

  • Members
  • PipPipPip
  • 276 posts
  • LocationHoboken, NJ

Posted 26 May 2011 - 06:39 PM

I wonder how hard it would be to create a post-build IL-to-native compiler.

I did some work on such a project (for a VERY limited subset of C#), but I haven't touched it in several weeks due to time constraints. Maybe I'll find some time to work on it. I was also a little uncertain about how useful the community found my particular approach.

http://forums.netdui...9-simplengen-11

#24 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 May 2011 - 06:54 PM

I did some work on such a project (for a VERY limited subset of C#), but I haven't touched it in several weeks due to time constraints. Maybe I'll find some time to work on it. I was also a little uncertain about how useful the community found my particular approach.

http://forums.netdui...9-simplengen-11

Corey is far too humble. SimpleNGEN is one of the coolest things I've seen done with .NET MF, and I'm really looking forward to seeing it evolve--and using it in my own projects.

Chris

#25 Corey Kosak

Corey Kosak

    Advanced Member

  • Members
  • PipPipPip
  • 276 posts
  • LocationHoboken, NJ

Posted 26 May 2011 - 08:58 PM

Corey is far too humble. SimpleNGEN is one of the coolest things I've seen done with .NET MF, and I'm really looking forward to seeing it evolve--and using it in my own projects.

Chris


Thank you Chris, that means a lot. OK maybe I'll try to reanimate this work after I return from my college reunion this weekend!! <_<




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.