-
Notifications
You must be signed in to change notification settings - Fork 936
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
IsDirty performance hit since 5.4.0 #3307
Comments
@trivalik can you share full screenshot for 3.3.1 and also expand all trees for |
For 3.3.1 is through there was none, it was: For 5.4.2 ( I can imagine that CascadeAfterSafe the problem is like in #1413): |
You said you have the same performance issue with 5.3. Did you check with 5.2? Can you share how profiling looks for 5.3 |
Then it's likely #2752 to blame |
I can confirm that the over 1 second run for |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@trivalik, I'm not sure either. Can you please test if changing this code: nhibernate-core/src/NHibernate/Event/Default/AbstractFlushingEventListener.cs Lines 187 to 202 in 90d50c0
And moving protected virtual void PrepareEntityFlushes(IEventSource session)
{
log.Debug("processing flush-time cascades");
ICollection list = IdentityMap.ConcurrentEntries(session.PersistenceContext.EntityEntries);
var context = Anything; // <<<< HERE
//safe from concurrent modification because of how entryList() is implemented on IdentityMap
foreach (DictionaryEntry me in list)
{
EntityEntry entry = (EntityEntry) me.Value;
Status status = entry.Status;
if (status == Status.Loaded || status == Status.Saving || status == Status.ReadOnly)
{
CascadeOnFlush(session, entry.Persister, me.Key, context /* <<<< HERE */);
}
}
} |
This comment was marked as outdated.
This comment was marked as outdated.
Moving out the Anything, out of the foreach loop lead to no |
@trivalik great. Can you submit a PR? |
I cannot get the SaveOrUpdate call with your code. |
You are right the unit test does not create a call of Here for the 5.4.x branch: Here with the Anything fix: |
I faced a longer IsDirty run after upgrading.
NHibernate 3.3.1:
NHibernate 5.4.2:
The first question is, was there a bug in old implementation that now lead to this cascade?
Since the result of IsDirty is true in both cases, I can imagine that there is optimization potential.
The test case of IsDirty is there that we have a table which stores for every element a parent element (not lazy load). The children are as HasMany relation. We remove just near all elements, and this lead to this bad result.
The text was updated successfully, but these errors were encountered: