text
stringlengths
1
474
the visual root of the treemap.To navigate back, or up a level, use the breadcrumb
navigator at the top of the treemap.<topic_end>
<topic_start>
Dominator tree and call graph
This section of the page shows code size attribution data
(for example, why a piece of code is included in your
compiled application). This data is visible
in the form of a dominator tree as well as a call graph.<topic_end>
<topic_start>Using the dominator tree
A dominator tree is a tree where each node’s
children are those nodes it immediately dominates.
A node a is said to “dominate” a node b if
every path to b must go through a.To put it in context of app size analysis,
imagine package:a imports both package:b and package:c,
and both package:b and package:c import package:d.In this example, package:a dominates package:d,
so the dominator tree for this data would look like:This information is helpful for understanding why certain
pieces of code are present in your compiled application.
For example, if you are analyzing your app size and find
an unexpected package included in your compiled app, you can
use the dominator tree to trace the package to its root source.<topic_end>
<topic_start>Using the call graph
A call graph provides similar information to the dominator
tree in regards to helping you understand why code exists
in a compiled application. However, instead of showing
the one-to-many dominant relationships between nodes of code
size data like the dominator tree, the call graph shows the many-to-many
relationships that existing between nodes of code size data.Again, using the following example:The call graph for this data would link package:d
to its direct callers, package:b and package:c,
instead of its “dominator”, package:a.This information is useful for understanding the
fine-grained dependencies of between pieces of your code
(packages, libraries, classes, functions).<topic_end>
<topic_start>Should I use the dominator tree or the call graph?
Use the dominator tree if you want to understand the
root cause for why a piece of code is included in your
application. Use the call graph if you want to understand
all the call paths to and from a piece of code.A dominator tree is an analysis or slice of call graph data,
where nodes are connected by “dominance” instead of
parent-child hierarchy. In the case where a parent node
dominates a child, the relationship in the call graph and the
dominator tree would be identical, but this is not always the case.In the scenario where the call graph is complete
(an edge exists between every pair of nodes),
the dominator tree would show the that root is the
dominator for every node in the graph.
This is an example where the call graph would give
you a better understanding around why a piece of code is
included in your application.<topic_end>
<topic_start>
Diff tab
The diff tab allows you to compare two snapshots of
size information. The two size information files
you are comparing should be generated from two different
versions of the same app; for example,
the size file generated before and after
changes to your code. You can visualize the
difference between the two data sets
using the treemap and table.<topic_end>
<topic_start>
Loading size files
When you open the Diff tab,
you’ll see instructions to load “old” and “new” size
files. Again, these files need to be generated from
the same application. Drag and drop these files into
their respective dialogs, and click Analyze Diff.See Generating size files below for information
on generating these files.<topic_end>
<topic_start>
Treemap and table
In the diff view, the treemap and tree table show
only data that differs between the two imported size files.For questions about using the treemap, see Using the treemap above.<topic_end>
<topic_start>
Generating size files
To use the app size tool, you’ll need to generate a
Flutter size analysis file. This file contains size
information for your entire application (native code,
Dart code, assets, fonts, etc.), and you can generate it using the
--analyze-size flag:This builds your application, prints a size summary
to the command line, and prints a line
telling you where to find the size analysis file.In this example, import the build/apk-code-size-analysis_01.json
file into the app size tool to analyze further.
For more information, see App Size Documentation.<topic_end>
<topic_start>
Other resources
To learn how to perform a step-by-step size analysis of
the Wonderous App using DevTools, check out the
App Size Tool tutorial. Various strategies
to reduce an app’s size are also discussed.
<topic_end>
<topic_start>DevTools extensions
<topic_end>
<topic_start>
What are DevTools extensions?
DevTools extensions are developer
tools provided by third-party packages that are tightly integrated into the
DevTools tooling suite. Extensions are distributed as part of a pub package,
and they are dynamically loaded into DevTools when a user is debugging their app.<topic_end>
<topic_start>
Use a DevTools extension
If your app depends on a package that provides a DevTools extension, the
extension automatically shows up in a new tab when you open DevTools.<topic_end>
<topic_start>
Configure extension enablement states