Skip to content

Commit 801ad8b

Browse files
jensjohacommit-bot@chromium.org
authored andcommitted
[cfe] Remember if finalizeExports was done
Before this CL, whenever a dill library builder was asked to compute the outline it would finalize its exports - even if it was already done. This is not really a problem (it mostly puts stuff into maps --- doing it again will just overwrite what's already there with the same thing again), but when having many dill library builders, and asking them to compute the outline again and again because we've added a few new ones (e.g. via kernel worker) it adds up to a lot of wasted time. This CL adds a boolean to the dill library builders to avoid re-doing this already done work. An internal benchmark via kernel worker of lots of outline calculations in worker mode with reuse and the incremental compiler (and lots of dill loaded dependencies) goes from ~149 seconds to ~143 seconds. Change-Id: I19cadbf64ff5e0ff117bad4df86c83832a1f28fa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105243 Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Kevin Millikin <[email protected]>
1 parent a1401e3 commit 801ad8b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class DillLibraryBuilder extends LibraryBuilder<KernelTypeBuilder, Library> {
6262
/// [../kernel/kernel_library_builder.dart].
6363
Map<String, String> unserializableExports;
6464

65+
bool exportsAlreadyFinalized = false;
66+
6567
DillLibraryBuilder(this.library, this.loader)
6668
: super(library.fileUri, new Scope.top(), new Scope.top());
6769

@@ -173,6 +175,8 @@ class DillLibraryBuilder extends LibraryBuilder<KernelTypeBuilder, Library> {
173175
}
174176

175177
void finalizeExports() {
178+
if (exportsAlreadyFinalized) return;
179+
exportsAlreadyFinalized = true;
176180
unserializableExports?.forEach((String name, String messageText) {
177181
Declaration declaration;
178182
switch (name) {

0 commit comments

Comments
 (0)