Analyzing build_runner perfomance logs #3833
Replies: 3 comments 8 replies
-
Hi :) I've been staring at these performance logs for a couple of weeks now, and one thing is clear: But problems with specific generators are also possible; and a third possibility is that the output is slow to format, So, profiling to check: Once you have a build script you can get a profile by running something like
then going to the URL it prints in your browser, going to the "CPU profile" tab, hitting record, then unpausing the isolate. If nothing in |
Beta Was this translation helpful? Give feedback.
-
@BuyMyBeard Fwiw see this doc on filtering which files a given generator runs on as well, if you haven't already done that. It won't fundamentally fix the problem but it can alleviate some of the issues if you ensure the builders aren't running on more files than they need to. |
Beta Was this translation helpful? Give feedback.
-
All these "transitive dependency" issues are associated with the particular execution model used by the build runner, where the annotations control the execution.
With this model, there's a clear separation between the compiler and the build process. This requires the restoration of mirrors, including the ability to execute code from sub-modules. (This eliminates the problem of const functions - this method doesn't need them) This is the simplest approach I can think of. I'm not sure the idea was explored before. (Using annotations as a driver for execution is inconvenient anyway: if you have N data classes for which you want to generate some FancySerializer, you can say |
Beta Was this translation helpful? Give feedback.
-
Hello! I develop on the daily a SAAS app built with flutter. Lately, my build times have been getting awful (~30-45s). I have build_runner generating json_serializable and freezed models, and also some routes with go_router_builder.
I noticed today that if I run
build_runner build
with args--build-filter="lib/models/**"
, the build time gets cut to about 5s, but if I instead do--build-filter="lib/routes/**"
, the build time is a whopping 25-30s!I want to diagnose the problem so I can go about fixing my own setup / contribute to go_router_builder, but I'm pretty lost here. I managed to launch the debug into build_runner with
".dart_tool/build/entrypoint/build.dart"
, and also use--track-perfomance --log-perfomance=logs
, But the generated log file is a whopping 127 megabytes, and no freeware json-viewer can handle this.What would be the best approach here to diagnose the problem?
Beta Was this translation helpful? Give feedback.
All reactions