-
Notifications
You must be signed in to change notification settings - Fork 129
[performance] Avoid O(n^2) in DeadlockDetector.lockAcquired() #1720
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
Conversation
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable.
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Outdated
Show resolved
Hide resolved
ee2e54e
to
0e86a5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found an issue here.
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Outdated
Show resolved
Hide resolved
If we talking about performance, it might be that
could be one pass if no new items where added to the set? |
03a5505
to
a3d776c
Compare
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Outdated
Show resolved
Hide resolved
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Outdated
Show resolved
Hide resolved
a3d776c
to
54ca5ee
Compare
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Show resolved
Hide resolved
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Show resolved
Hide resolved
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Show resolved
Hide resolved
@laeubi please accept the code style as is or proof that your optimizations perform faster. To me it looks like adding additional code does not help. |
Its hard to tell as you have not given any numbers of the "severe hotspot in workspace with n= ~1000 projects" I just assumed that if you want to avoid loop over, then you want to avoid copy as well as it also requires time but it is of course just a rough idea. |
I only want to avoid n times ArrayList#contains for obvious performance reasons if the set becomes just large enough, especially if all of those n jobs do it. |
54ca5ee
to
81826a6
Compare
runtime/bundles/org.eclipse.core.jobs/src/org/eclipse/core/internal/jobs/DeadlockDetector.java
Outdated
Show resolved
Hide resolved
With n conflicting rules. "conflicting.contains(possible)" has been observed as severe hotspot in a workspace with n= ~1000 projects, especially because all n Jobs did the same. Also avoid second pass if nothing changed. Functionality is tested with IJobManagerTest.testTransferToJobWaitingOnChildRule() OrderedLockTest.testComplex() DeadlockDetectionTest.testImplicitRules()
81826a6
to
8ff13cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now
@laeubi thanks for all the good findings. |
build #7 failed with |
Good improvements, good suggestions, and good team work guys! 🏆 |
ignoring unrelated failure in windows verification: eclipse-platform/eclipse.platform.swt#1801 |
With n conflicting rules. Has been observed as severe hotspot in workspace with n= ~1000 projects
Functionality is tested with
IJobManagerTest.testTransferToJobWaitingOnChildRule()