Skip to content

Find a pattern to avoid the cost of reformatting identical Dart code #3786

Open
@natebosch

Description

@natebosch

Most codegen uses the formatter to create a consistent and readable output. The formatting always happens in the same builder as the code generation. This means that even when a builder produces identical output it pays the cost to reformat.

If it was more common to have a build_to: cache intermediate asset with the unformatted Dart code and formatted it in a separate build step then we would often short circuit the formatting steps.

Or maybe we could look at something like a way to record a hash of the "meaningful" input from read assets or a fingerprint of preformatted generated code. This would be a bit like baking in the pattern we've used in some code generators where we first read information into a JSON asset which can short circuit any builders that use it as input, then a separate build step reads the JSON asset to produce formatted code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requesttype-performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions