Bug 567595 - fix quadratic runtime of resolveRuntimeClasspath
JavaRuntime.resolveRuntimeClasspath first resolves the classpath and
then removes the entry for the JRE. The latter step has quadratic
runtime over the length of the classpath. It iterates over all entries.
For each entry it calls JavaProject.findPackageFragmentRoot(), which
calls JavaProject.getAllPackageFragmentRoots() and then iterates
over all package fragment roots.
Fixed by computing the path to the JRE before the outer loop. This
reduces the runtime to O(n).
Signed-off-by: Andreas Huber <firstname.lastname@example.org>
Tested-by: JDT Bot <email@example.com>
Reviewed-by: Andrey Loskutov <firstname.lastname@example.org>
1 file changed