-
Notifications
You must be signed in to change notification settings - Fork 127
Optimize peak heap usage #1858
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
Optimize peak heap usage #1858
Conversation
…iles in time for empty packages
@bwilkerson can you review this? |
This is now ready for review. I recommend using this link to show the differences from #1851. |
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.
LGTM. I'm fine with having the imports replaced in a follow-on PR.
lib/src/model.dart
Outdated
@@ -10,6 +10,7 @@ import 'dart:collection' show UnmodifiableListView; | |||
import 'dart:convert'; | |||
import 'dart:io'; | |||
|
|||
import 'package:analyzer/analyzer.dart'; |
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.
This library is deprecated and will hopefully be removed soon. Please replace this import with imports of more specific libraries, even if they are private libraries.
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.
done
lib/src/model.dart
Outdated
class _HashableChildLibraryElementVisitor | ||
extends GeneralizingElementVisitor<void> { | ||
final void Function(Element) libraryProcessor; | ||
_HashableChildLibraryElementVisitor(this.libraryProcessor) {} |
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.
style nit: consider replacing "{}" with ";" (here and elsewhere)
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.
done
lib/src/model.dart
Outdated
@@ -6652,7 +6722,7 @@ class PackageBuilder { | |||
} | |||
} | |||
} while (!lastPass.containsAll(current)); | |||
return libraries; | |||
return; |
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.
style nit: consider removing this line
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.
done
lib/src/model_utils.dart
Outdated
@@ -7,6 +7,7 @@ library dartdoc.model_utils; | |||
import 'dart:convert'; | |||
import 'dart:io'; | |||
|
|||
import 'package:analyzer/analyzer.dart'; |
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.
Please also replace this import.
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.
done
Going to land this by force-landing #1851 and then doing the git dance to land this one. |
For testing/landing purposes, this includes #1851, but is only different from that PR by the final 3 commits, starting with: 2afd621.
While this eliminates some extra traversal of ResolvedUnitResults and saves on peak memory, the cost is a slightly more complicated PackageGraph initialization that requires some callbacks in getLibraries.