Posts

Showing posts from December, 2012

Category:SaaS - Software as a Story

Software is about people, and people like stories.  Thus, I'm  adding a new category SaaS or Software as a Story, to the blog. This will be a chance to tell stories related to software engineers and software engineering.  Some stories will be happy and some stories will be sad, some stories will be mine, and some will be my friends,  some of the stories might even be true, but ascertaining the truth of the story will be left as an  exercise  for the reader.  Fire me a mail if you'd like to donate a story.

Dumping the method descriptor for a System.Action (delegate)

In my previous post I needed to figure out what method descriptor a System.Action points to. This is painful so I wrote a small debugger script to automate it.  To use the script, copy  this code  to dumpMDForAction.dbg. Many thanks to Alois Kraos  for posting how to do this. Without further ado, fire up cdb and  find a System.Action: 0:000> !do 0000003de7023078 Name: System.Action MethodTable: 000007f9d26b9a68 EEClass: 000007f9d2071c10 Size: 64(0x40) bytes File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll Fields: MT Field Offset Type VT Attr Value Name 000007f9d26c1ac8 400002d 8 System.Object 0 instance 0000003de7023078 _target 000007f9d26c1ac8 400002e 10 System.Object 0 instance 0000003de7028800 _methodBase 000007f9d26c60d8 400002f 18 System.IntPtr 1 instance 3de52e0900 _methodPtr 000007f9d26c60d8 4

Cool Tools:LinqPad

If you use C# and you don't use LinqPad , drop everything you're doing and download it -  it will change your life.  LinqPad is so great, I'm not going to describe it - just download and run it.

Run time costs of small operations in C#.

Image
Thank you smart people that helped me understand this:  Vance Morrison ; Kevin Frei; Dave Detlefs; Jan Kotas; Sean Selitrennikoff; Nathan Iarovich; Dave Driver. One of my colleagues read this post and pointed out for really small operations e.g  {i++ } the cost of the measurement system is exceeding the cost of the operations. I agree completely,  and recommend using  measure it  and reading the help if you need to measure small things. My colleague also noticed something interesting; in this code    (full  code  here , proof of concept in linqpad using measureit .) : class Program { static int interlocked = 0; static int staticInt = 0; static void DoNop() { } static void IncrementStaticInt() { staticInt++; } // This is an array to make it easier to debug in cdb. static NamedAction[] namedActions; static void Main(string[] args) { int localInt = 0; namedActions = new NamedAction[