Rico is doing some very interesting work to get some sort of idea about the allocation overhead of using different parts of the .NET Framework. As he says, this is a fairly rough approximation done just with static analysis, but it does give you something to chew on.

Rico starts by focusing on making a good hashcode function…

I thought I'd look at properties. As you know the Framework Design Guidelines encourages you to make simple properties that are logically just fields. There is a reasonable assumption that the get accessor of a property would not have to allocate any data.

The good news is the vast majority of these had 0 or 1 allocation. The thing to watch out for is that some of the worst offenders are properties, with 15 with a score over 10… that will certainly be a surprise in your working set if you were expecting just a field access!

Check out the costs file for your own look… can't wait to see what interesting things you folks find with this data.

 

Thanks Rico!