| commit | 777ce9b3687cfb9398b2a280055c8b78ad742ecc | [log] [tgz] |
|---|---|---|
| author | Konstantin Shcheglov <scheglov@google.com> | Mon Jan 23 18:05:44 2023 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Jan 23 18:05:44 2023 +0000 |
| tree | c37c9828ea0567a6494d1f2b13b155ba5903a4eb | |
| parent | 03ab72a35d34ed4ba8d77e35c967a81ba68d0ef1 [diff] |
Use UriCache to ensure there is only one instance of Uri for each string.
I tested this on rwf-materials/01-setting-up-your-environment
Short version:
1. 475060 less live objects.
2. 37.5 MB less heap usage.
Before:
[Analysis contexts: 35]
[time: 20575 ms]
[4781 ms] Downloaded heap snapshot, 641.5832576751709 MB.
[26763 ms] Created HeapSnapshotGraph.
externalSize: 7168
shallowSize: 1796013552
Objects: 23954314
[26764 ms] Created Analysis.
All objects.
size count class
-------- -------- --------
284017 kb 2194914 _OneByteString dart:core
269992 kb 2088293 _List dart:core
229846 kb 2066511 _Uint32List dart:typed_data
154248 kb 4935956 _GrowableList dart:core
63042 kb 158891 _Uint8List dart:typed_data
56224 kb 1199459 Reference package:analyzer/src/summary2/reference.dart
42643 kb 682297 _InfoMethodDeclaration package:analyzer/src/summary2/informative_data.dart
40358 kb 234812 PropertyAccessorElementImpl_ImplicitGetter package:analyzer/src/dart/element/element.dart
38075 kb 203067 ConstFieldElementImpl package:analyzer/src/dart/element/element.dart
34247 kb 438367 _SimpleUri dart:core
32181 kb 686528 _InfoFormalParameter package:analyzer/src/summary2/informative_data.dart
29730 kb 475686 _Closure dart:core
27722 kb 6868 _TwoByteString dart:core
25594 kb 409517 _Map dart:collection
17778 kb 81273 ClassElementImpl package:analyzer/src/dart/element/element.dart
16479 kb 411893 Context
14672 kb 93903 LibraryImportElementImpl package:analyzer/src/dart/element/element.dart
14074 kb 90077 ParameterElementImpl package:analyzer/src/dart/element/element.dart
13316 kb 284078 _InfoFieldDeclaration package:analyzer/src/summary2/informative_data.dart
12932 kb 19671 Instructions
-------- --------
1739370 kb 23741574
Instances of: _SimpleUri
size count class
-------- -------- --------
34247 kb 438367 _SimpleUri dart:core
size unique-size count class data
-------- -------- -------- -------- --------
313 kb 0 kb 10024 _OneByteString dart:core
189 kb 0 kb 4033 _OneByteString package:flutter/foundation.dart
100 kb 0 kb 2137 _OneByteString package:flutter/widgets.dart
76 kb 0 kb 1626 _OneByteString package:flutter/rendering.dart
68 kb 0 kb 2207 _OneByteString dart:ui
62 kb 0 kb 1994 _OneByteString dart:async
62 kb 0 kb 1989 _OneByteString dart:math
43 kb 0 kb 935 _OneByteString package:flutter/services.dart
43 kb 0 kb 1378 _OneByteString theme.dart
42 kb 0 kb 907 _OneByteString package:flutter/gestures.dart
39 kb 0 kb 1278 _OneByteString framework.dart
38 kb 0 kb 1243 _OneByteString debug.dart
29 kb 0 kb 466 _OneByteString package:vector_math/vector_math_64.dart
27 kb 0 kb 594 _OneByteString package:flutter/scheduler.dart
27 kb 0 kb 577 _OneByteString package:meta/meta.dart
25 kb 0 kb 549 _OneByteString material_state.dart
25 kb 0 kb 549 _OneByteString material_localizations.dart
25 kb 0 kb 822 _OneByteString colors.dart
23 kb 0 kb 510 _OneByteString package:flutter/material.dart
23 kb 0 kb 752 _OneByteString basic.dart
-------- -------- --------
11153 kb 258 kb 201628
After:
[Analysis contexts: 35]
[time: 20763 ms]
[4711 ms] Downloaded heap snapshot, 620.3819370269775 MB.
[25756 ms] Created HeapSnapshotGraph.
externalSize: 5984
shallowSize: 1758470480
Objects: 23479254
[25756 ms] Created Analysis.
All objects.
size count class
-------- -------- --------
278669 kb 2110355 _OneByteString dart:core
270129 kb 2088300 _List dart:core
229910 kb 2066512 _Uint32List dart:typed_data
154248 kb 4935956 _GrowableList dart:core
63049 kb 159021 _Uint8List dart:typed_data
56224 kb 1199459 Reference package:analyzer/src/summary2/reference.dart
42643 kb 682297 _InfoMethodDeclaration package:analyzer/src/summary2/informative_data.dart
40358 kb 234812 PropertyAccessorElementImpl_ImplicitGetter package:analyzer/src/dart/element/element.dart
38075 kb 203067 ConstFieldElementImpl package:analyzer/src/dart/element/element.dart
32181 kb 686528 _InfoFormalParameter package:analyzer/src/summary2/informative_data.dart
29730 kb 475686 _Closure dart:core
27722 kb 6868 _TwoByteString dart:core
25594 kb 409517 _Map dart:collection
17778 kb 81273 ClassElementImpl package:analyzer/src/dart/element/element.dart
16479 kb 411893 Context
14672 kb 93903 LibraryImportElementImpl package:analyzer/src/dart/element/element.dart
14074 kb 90077 ParameterElementImpl package:analyzer/src/dart/element/element.dart
13316 kb 284078 _InfoFieldDeclaration package:analyzer/src/summary2/informative_data.dart
12937 kb 19673 Instructions
11985 kb 191772 InterfaceTypeImpl package:analyzer/src/dart/element/type.dart
-------- --------
1700325 kb 23223116
Instances of: _SimpleUri
size count class
-------- -------- --------
359 kb 4598 _SimpleUri dart:core
size unique-size count class data
-------- -------- -------- -------- --------
0 kb 0 kb 1 _OneByteString file:///Users/scheglov/dart/rwf-materials/01-setting-up-your-environment/project
0 kb 0 kb 1 _OneByteString file:///Users/scheglov/dart/rwf-materials/01-setting-up-your-environment/project
0 kb 0 kb 1 _OneByteString package:firebase_dynamic_links_platform_interface/src/platform_interface/platfor
0 kb 0 kb 1 _OneByteString package:infinite_scroll_pagination/src/widgets/helpers/default_status_indicators
0 kb 0 kb 1 _OneByteString package:infinite_scroll_pagination/src/widgets/helpers/default_status_indicators
0 kb 0 kb 1 _OneByteString package:infinite_scroll_pagination/src/widgets/helpers/default_status_indicators
0 kb 0 kb 1 _OneByteString package:firebase_remote_config_platform_interface/src/platform_interface/platfor
0 kb 0 kb 1 _OneByteString package:firebase_dynamic_links_platform_interface/src/method_channel/method_chan
0 kb 0 kb 1 _OneByteString package:firebase_core_platform_interface/src/platform_interface/platform_interfa
0 kb 0 kb 1 _OneByteString package:infinite_scroll_pagination/src/widgets/helpers/default_status_indicators
0 kb 0 kb 1 _OneByteString package:infinite_scroll_pagination/src/widgets/helpers/default_status_indicators
0 kb 0 kb 1 _OneByteString package:firebase_analytics_platform_interface/src/method_channel/method_channel_
0 kb 0 kb 1 _OneByteString package:firebase_remote_config_platform_interface/src/method_channel/method_chan
0 kb 0 kb 1 _OneByteString package:infinite_scroll_pagination/src/widgets/helpers/default_status_indicators
0 kb 0 kb 1 _OneByteString package:firebase_crashlytics_platform_interface/src/platform_interface/platform_
0 kb 0 kb 1 _OneByteString package:firebase_crashlytics_platform_interface/src/method_channel/method_channe
0 kb 0 kb 1 _OneByteString package:firebase_analytics_platform_interface/src/platform_interface/platform_in
0 kb 0 kb 1 _OneByteString package:firebase_dynamic_links_platform_interface/src/method_channel/utils/conve
0 kb 0 kb 1 _OneByteString package:infinite_scroll_pagination/src/widgets/helpers/default_status_indicators
0 kb 0 kb 1 _OneByteString package:firebase_core_platform_interface/src/platform_interface/platform_interfa
-------- -------- --------
260 kb 260 kb 4598
Change-Id: I31e0c5ee979e360021bf65a532424f0bd19a0820
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279450
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Dart is:
Optimized for UI: Develop with a programming language specialized around the needs of user interface creation.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app.
Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents on our wiki.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.