Performance Implications on Objects Creation

I while ago I’ve run across this post by Ayende regarding performance implications when creating objects. I’ve decided to play with his sample code in order to learn some of his techniques regarding IL generation and DynamicMethod. I’ve also found this post by Roger Alsing, which adds another variation to Ayende’s original post. Please, read both posts before reading the rest of mine.

When I was messing with that, I’ve adjusted the samples just to get the benchmark results more easily, so that it displays like this:

perf

I’ve also refactored the sample code just to make it easier for me to try out different approaches (like Roger’s approach using Expression Trees), plug in the benchmark logger, etc.

If you’re interested, you can download a solution containing the full sample code here, so you can try it out yourself.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: