INotifyOnChange Performance Issues

Intresting article here; that profiles the performance of doing change notification varying ways. Notably the typical Lambda method of change notification is 3-20 times slower than string based notifications.

Lambdas have some value outside performance that must be weighed, but if your app is sluggish and uses a lot of bindings; something to consider.

Advertisements

3 thoughts on “INotifyOnChange Performance Issues

  1. Hey,

    There is an alternative which is to use the lambda only to get the name and then to store it in a static object like in Cinch v1. Then you get the best ot the both world 🙂

    Regards,

    • Zubin Appoo says:

      Hi Jonathon – can you explain what you mean by getting the name and storing staticly? Won’t this still be a perf hit to evaluate and run the lambda?

      • adammills says:

        Cinch creates the eventArgs in the static constructor, using lambdas. So you get the hit once.
        Then in the instance you raise the change using the pre-created eventArgs. Thus only paying the cost once.

        Caliburn takes that a step further and creates property definitions in the class contructor. They store the value of the property as well as raise notification. This way they can also implement IEditableObject.

        They do bloat the class a little though.

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: