You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find that freezed code generation is quite slow.
When I launch the code generation with dart run build_runner build --config freezed --delete-conflicting-outputs, it take 22 seconds to generate 15 files.
Describe the solution you'd like
I would like to compile the freezed package because compiled code is usually much faster than interpreted one.
I tried to compile it, but the dependency on dart:mirrors make it fail.
Describe alternatives you've considered
I also try to reduce the number of file freezed should analyze by exclude files I know don't contain freezed annotation.
It decrease the time from around 1 minute to 22 seconds.
I used dart run build_runner serve --config freezed --delete-conflicting-outputs --track-performance to view the time graph and see which builder/file take time to build.
Now, only the file I am interested in are rebuilt, but it is still quite slow
Additional context
I created a code generator with code_builder, which generate about the same amount of code, but it only take 5 secondes with dart run, and under a second with the compile version.
I don't understand why Freezed is so slow. Is it because it analyze all my code base and all its dependencies ?
I use Freezed for many projects, and it always take between 10 seconds and a whole minute to complete.
Using dart run build_runner serve is much faster for incremental rebuild, but it is not always feasible to use it.
It adds a lot of lost time when prototyping an application.
Maybe the issue is in build_runner ?
The text was updated successfully, but these errors were encountered:
I used dart run build_runner serve --config freezed --delete-conflicting-outputs --track-performance to view the time graph and see which builder/file take time to build.
What did it say in your case?
The bottleneck should be the analyzer. Freezed is just doing a bunch of string concatenation. Nothing that should take ages
It'd help a lot if you could share a reproducible sample.
Since a bit unclear what's the bottleneck with what you shared (since I can't zoom on the time chart). My guess is that it's analyzer that's slow and that as such there's nothing I can do.
It would be great to have here some improvements. The code generation became while adding new classes over the time by factor 3! In average does the generation take now 45 seconds on my intel mac.
Here is the output of my last run (my mac throtteld as hell but anyway):
[INFO] Running build completed, took 4m 22s
[INFO] Caching finalized dependency graph completed, took 457ms
[INFO] Succeeded after 4m 22s with 24 outputs (183 actions)
I find that freezed code generation is quite slow.
When I launch the code generation with
dart run build_runner build --config freezed --delete-conflicting-outputs
, it take 22 seconds to generate 15 files.Describe the solution you'd like
I would like to compile the freezed package because compiled code is usually much faster than interpreted one.
I tried to compile it, but the dependency on dart:mirrors make it fail.
Describe alternatives you've considered
I also try to reduce the number of file freezed should analyze by exclude files I know don't contain freezed annotation.
It decrease the time from around 1 minute to 22 seconds.
I used
dart run build_runner serve --config freezed --delete-conflicting-outputs --track-performance
to view the time graph and see which builder/file take time to build.Now, only the file I am interested in are rebuilt, but it is still quite slow
Additional context
I created a code generator with
code_builder
, which generate about the same amount of code, but it only take 5 secondes withdart run
, and under a second with the compile version.I don't understand why Freezed is so slow. Is it because it analyze all my code base and all its dependencies ?
I use Freezed for many projects, and it always take between 10 seconds and a whole minute to complete.
Using
dart run build_runner serve
is much faster for incremental rebuild, but it is not always feasible to use it.It adds a lot of lost time when prototyping an application.
Maybe the issue is in
build_runner
?The text was updated successfully, but these errors were encountered: