Suggestion for performance improvement of BusinessListBase.IsSavable

Suggestion for performance improvement of BusinessListBase.IsSavable

Old forum URL: forums.lhotka.net/forums/t/5679.aspx


dlabar posted on Monday, October 27, 2008

Rocky,

I noticed that you've added code in BusinessListBase.IsSavable property to see if a user has authorization to edit the object, and assigned that to a local variable, but on the return statement, you call IsDirty and IsValid first.  With short circuting, you'd have better performance if auth is false, if you changed from this:

return (IsDirty && IsValid && auth && !IsBusy);

to:

return (auth && IsDirty && IsValid && !IsBusy);

If auth is false, you'd never have to loop through all the objects twice for IsDirty and IsValid

RockfordLhotka replied on Tuesday, October 28, 2008

Thanks, I'll add that to the to-do list.

RockfordLhotka replied on Tuesday, October 28, 2008

Interestingly enough, it was correct in .NET, but not SL - good catch.

Copyright (c) Marimer LLC