commit | b6b0e439dff973ddd2e36d992940fb5a4a9b1947 | [log] [tgz] |
---|---|---|
author | Jacob MacDonald <jakemac@google.com> | Mon Feb 03 13:46:40 2025 -0800 |
committer | GitHub <noreply@github.com> | Mon Feb 03 13:46:40 2025 -0800 |
tree | c6b0289e2dab8b7a355d625bf0ade45ec260cae5 | |
parent | b38abb81337b10c4b675d418e50f82a5fe6a894d [diff] |
optimize cpu_profile_transformer to not create intermediate lists (#8839) Uses an iterator over the stack frame values in CpuProfileTransformer, instead of allocating new lists for they keys and values in the map, which are then read by index. I also removed the late/nullable fields in favor of local variables, since the state was never used outside of a single method call. As far as I could tell the keys were never actually used except to look up values in the map, so I dropped that entirely. There was an extra lookup in the map and local variable which I am pretty certain wasn't needed. This isn't directly related to any specific issue, I just noticed it as I was perusing through some of the code for the cpu profiler and figured I would send something out, to dip my toes in here :). No tests were added, the behavior should be unchanged so hopefully existing tests should cover it. I did also add a TODO because I noticed a piece of logic that was O(N^2) worst case here but I don't know enough about how large the N is expected to be or whether its a common path, and it would be more involved to fix.
Dart & Flutter DevTools is a suite of performance tools for Dart and Flutter.
For documentation on installing and trying out DevTools, please see our docs.
Contributions welcome! See our contributing page for an overview of how to build and contribute to the project.
By using Dart DevTools, you agree to the Google Terms of Service. To understand how we use data collected from this service, see the Google Privacy Policy.