1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00
cdt/build
Marc-Andre Laperle 9e7b5beaa9 Bug 565553 - Improve performance of build command parsers with large number of files
Cache results of various path resolution algorithms.

Resolving paths is particularly slow while creating entries, see
AbstractLanguageSettingsOutputScanner.createResolvedPathEntry.

There are three main callees within that method that this patch addresses with
a caching approach:

* findContainerForLocationURI: First, this finds containers for a given URI in
the workspace using Eclipse resources API. Then a single container is
selected based on a preferred project. This can done repeatedly for include
paths, which are often similar for source files in a given project or source
folder. This first step is the expensive one and it only depends on one
argument (the URI) and a simple IResource[] return type, so the cache here is
done for this operation. Then the post-filtering is kept as is.

* findFileForLocationURI: Similar to the container case but for files. A
typical projet has much less file paths than folder paths in its options. One
more common option using file paths is -include. The same approach is applied
here as the previous point because there are performance gains but they are
smaller if you consider typical projet setup.

* findBestFitInWorkspace: When a path cannot be found, this makes an attempt to
find the parsed path relative to every folder of the workspace, by starting
first with the preferred project, then its referenced projects and then the
rest. Caching the result of findBestFitInWorkspace itself is too cumbersome
because the result depends on 3 variables (currentProject,
currentCfgDescription and parsedName) which would make a complex cache key.
Instead, caching the result of findPathInFolder at the project level is
sufficient, with little to no performance difference.

In all three cases, the class LRUCache is used in order to limit memory
consumption of the cache. A limit of 100 elements for each cache was chosen
based on experimentation with a few projects like LLVM and projets several
times bigger. A limit higher than necessary for small projects does not incur a
noticeable overhead for small projects and a limit too small for very large
projects merely diminishes the performance gains.

Using LLVM code base as a test, the time to parse options for all files:
Before: 68395ms, after: 5599ms

Change-Id: Ib997e9373087950f9ae6d93bbb1a5f265431c6bc
Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
2020-08-03 12:47:18 -04:00
..
org.eclipse.cdt.autotools-feature [releng] Bump version to 10.0.0 2020-04-11 17:46:58 -04:00
org.eclipse.cdt.autotools.core Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.autotools.docs Set maven-antrun-plugin to 3.0.0 2020-07-22 09:30:30 +03:00
org.eclipse.cdt.autotools.tests Bug 561406 - Revise API for CDT Autotools 2020-03-28 14:38:02 -04:00
org.eclipse.cdt.autotools.ui Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.autotools.ui.tests Bug 561406 - Revise API for CDT Autotools 2020-03-28 14:38:02 -04:00
org.eclipse.cdt.build.gcc.core Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.build.gcc.ui Bug 561539 - Revise API for CDT Build GCC support 2020-03-30 13:52:08 +03:00
org.eclipse.cdt.cmake-feature [releng] Bump version to 10.0.0 2020-04-11 17:46:58 -04:00
org.eclipse.cdt.cmake.core Bug 565586: Handle -include and -imacros compiler flags 2020-07-31 13:21:28 -04:00
org.eclipse.cdt.cmake.ui Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.cmake.ui.tests [releng] Bump version to 10.0.0 2020-04-11 17:46:58 -04:00
org.eclipse.cdt.core.autotools-feature [releng] Bump version to 10.0.0 2020-04-11 17:46:58 -04:00
org.eclipse.cdt.core.autotools.core Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.core.autotools.ui Bug 561406 - Revise API for CDT Autotools 2020-03-25 22:22:10 +03:00
org.eclipse.cdt.gnu.build-feature [releng] Bump version to 10.0.0 2020-04-11 17:46:58 -04:00
org.eclipse.cdt.make.core Bug 564272: Increment major version of org.eclipse.cdt.core to 7.0.0 2020-06-13 16:21:05 -04:00
org.eclipse.cdt.make.core.tests Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.make.ui Bug 564949 - Remove support for CDT 3.X style projects (partial) 2020-07-07 22:26:01 -04:00
org.eclipse.cdt.make.ui.tests Bug 540373: Update the compiler warnings/ignores 2018-11-24 10:55:06 +00:00
org.eclipse.cdt.managedbuilder.core Bug 565553 - Improve performance of build command parsers with large number of files 2020-08-03 12:47:18 -04:00
org.eclipse.cdt.managedbuilder.core.tests Fix CompilationDatabaseParserTest wrongly running the parser twice simultaneously 2020-08-03 12:45:52 -04:00
org.eclipse.cdt.managedbuilder.gnu.ui Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.managedbuilder.ui Bug 564949 - Remove support for CDT 3.X style projects (partial) 2020-07-07 22:26:01 -04:00
org.eclipse.cdt.managedbuilder.ui.tests Bug 540373: Update the compiler warnings/ignores 2018-11-24 10:55:06 +00:00
org.eclipse.cdt.meson-feature [releng] Bump version to 10.0.0 2020-04-11 17:46:58 -04:00
org.eclipse.cdt.meson.core Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.meson.docs Set maven-antrun-plugin to 3.0.0 2020-07-22 09:30:30 +03:00
org.eclipse.cdt.meson.ui Fixed NLS and null warnings 2020-07-04 04:20:49 -04:00
org.eclipse.cdt.meson.ui.editor Bug 540373: Update the compiler warnings/ignores 2018-11-24 10:55:06 +00:00
org.eclipse.cdt.meson.ui.tests [releng] Bump version to 10.0.0 2020-04-11 17:46:58 -04:00
pom.xml [releng] Bump version to 10.0.0 2020-04-11 17:46:58 -04:00