Commit 2f8a59a
[analyzer] Fix duplicated excluded globs
With 39c60bc
(https://dart-review.googlesource.com/c/sdk/+/464762) it suddenly took
more than 7 minutes to start the analysis server on my machine.
Turns out it was caused by duplicated exclude globs.
This should fix the issue (and avoid some traversing of the filesystem)
and takes startup back to a more reasonable time.
By applying this patch:
```
diff --git a/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart b/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
index 72a821c..0c7f8ead5d2 100644
--- a/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart
@@ -101,6 +101,10 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
optionsFile: optionsFile,
packagesFile: packagesFile,
);
+ for(var root in roots) {
+ // ignore: avoid_dynamic_calls
+ print("Root with ${(root as dynamic).excludedGlobs.length} globs");
+ }
byteStore ??= MemoryByteStore();
```
and running
```
out/ReleaseX64/dart-sdk/bin/dart pkg/analysis_server/bin/server.dart --train-using pkg/front_end
```
so I can see the number of excluded globs in each root, before this CL
it printed `Root with 19958 globs`.
With this CL it prins `Root with 34 globs` (which it also did before 39c60bc).
Change-Id: Ie0b5edc7eede4c28394cd3d20334f9f1ad8417d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465920
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>1 parent 6b72a9c commit 2f8a59a
File tree
2 files changed
+54
-13
lines changed- pkg/analyzer
- lib/src/dart/analysis
- test/src/dart/analysis
2 files changed
+54
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
408 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
412 | 413 | | |
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
416 | 420 | | |
417 | 421 | | |
418 | 422 | | |
| |||
470 | 474 | | |
471 | 475 | | |
472 | 476 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
479 | 485 | | |
480 | 486 | | |
481 | 487 | | |
| |||
487 | 493 | | |
488 | 494 | | |
489 | 495 | | |
| 496 | + | |
490 | 497 | | |
491 | 498 | | |
492 | 499 | | |
| |||
507 | 514 | | |
508 | 515 | | |
509 | 516 | | |
510 | | - | |
511 | | - | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
512 | 520 | | |
513 | 521 | | |
514 | 522 | | |
| |||
553 | 561 | | |
554 | 562 | | |
555 | 563 | | |
| 564 | + | |
556 | 565 | | |
557 | 566 | | |
558 | 567 | | |
| |||
Lines changed: 35 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
641 | 642 | | |
642 | 643 | | |
643 | 644 | | |
644 | | - | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
645 | 650 | | |
646 | 651 | | |
647 | 652 | | |
| |||
662 | 667 | | |
663 | 668 | | |
664 | 669 | | |
665 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
666 | 678 | | |
667 | 679 | | |
668 | 680 | | |
| |||
680 | 692 | | |
681 | 693 | | |
682 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
683 | 704 | | |
684 | 705 | | |
685 | 706 | | |
| |||
690 | 711 | | |
691 | 712 | | |
692 | 713 | | |
693 | | - | |
| 714 | + | |
| 715 | + | |
694 | 716 | | |
695 | 717 | | |
696 | 718 | | |
| |||
1686 | 1708 | | |
1687 | 1709 | | |
1688 | 1710 | | |
| 1711 | + | |
1689 | 1712 | | |
1690 | 1713 | | |
1691 | 1714 | | |
1692 | 1715 | | |
1693 | 1716 | | |
1694 | 1717 | | |
1695 | 1718 | | |
| 1719 | + | |
1696 | 1720 | | |
1697 | 1721 | | |
1698 | 1722 | | |
| |||
1809 | 1833 | | |
1810 | 1834 | | |
1811 | 1835 | | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
1812 | 1843 | | |
1813 | 1844 | | |
1814 | 1845 | | |
| |||
1944 | 1975 | | |
1945 | 1976 | | |
1946 | 1977 | | |
| 1978 | + | |
1947 | 1979 | | |
0 commit comments