Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BusinessObjectCollection performance improvements #29

Open
jeff2001 opened this issue Nov 14, 2013 · 0 comments
Open

BusinessObjectCollection performance improvements #29

jeff2001 opened this issue Nov 14, 2013 · 0 comments

Comments

@jeff2001
Copy link
Contributor

Redmine Issue #1395

There are numerous places that performance of the class could be improved.
A basic search of all the Contains methods would make this obvious, but for this particular instance, the following was giving a massive performance hit.

When running CreateBussinessObject() the following method gets slower and slower each time you add a BO:

private void AddCreatedBusinessObject(TBusinessObject newBO)
{
            if (!this.CreatedBusinessObjects.Contains(newBO))
    {
                CreatedBusinessObjects.Add(newBO);
            }
            if (this.Contains(newBO)) return;
AddWithoutEvents(newBO);
        }

If you are doing a batch update of properties, the following method gets slower the larger your collection gets.
I think it should only be necessary to do any of the stuff if an event handler is registered.

private void BOPropUpdatedEventHandler(object sender, BOPropUpdatedEventArgs propEventArgs)
{
            TBusinessObject businessObject;
            lock (KeyObjectHashTable)
    {
                businessObject = propEventArgs.BusinessObject as TBusinessObject;
if (!this.Contains(businessObject)) return;
            }
            FireBusinessObjectPropertyUpdated(businessObject, propEventArgs.Prop);
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant