Skip to content

optimize building generated files #1304

@dave-doty

Description

@dave-doty

Sorry, this may not be appropriate as a GitHub issue, but I just wanted to ask for advice/clarification on how built_value generates the .g.dart files.

My project has gotten to the point of using hundreds of built_value instances. It now takes about a minute to compile, sometimes two, which slows down development when testing several incremental changes consecutively.

In this comment with the OverReact authors: Workiva/over_react#434 (comment), they suggest that built_value takes a while to compile on large projects because of its use of this package: https://pub.dev/packages/source_gen

I don't really understand the issues. I know OverReact itself generates code in .g.dart files, and I have about as many OverReact classes, of similar complexity, as built_value classes. Of course I don't know for sure that they are not also slowing things down, but according to the authors, their code generation is much faster.

So I'm wondering

  1. Whether you agree that source code generation is slower with source_gen than other methods.
  2. If you think there is some way (whether by switching away from source_gen, or something else) to speed up compilation.

Thank you.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions