Skip to content

Conversation

@hanno-becker
Copy link
Contributor

Various smaller improvements to speed up scripts/autogen.

On my local machine: 40s -> 16s

@hanno-becker hanno-becker marked this pull request as ready for review November 2, 2025 04:37
@hanno-becker hanno-becker requested a review from a team as a code owner November 2, 2025 04:37
@hanno-becker hanno-becker force-pushed the autogen_faster branch 2 times, most recently from 2cf4003 to 4f6565c Compare November 3, 2025 11:07
scripts/autogen Outdated
gen_preprocessor_comments()
high_level_status("Generated preprocessor comments")

finalize()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there no args.dry_run here?
I don't understand how the linting works. I thought it will fail in the finalize step, but that does not seem to be the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, thank you for catching this. This is crucial.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Instead of writing updated content to FS immediately,
redirect all file read/write operations through an
internal in-memory cache, and flush to memory only
at the end. This also has the side-benefit that intermediate
steps in dry-run don't need to produce the final file,
so we can format only once in the end.

Formatting performance is improved by processing multiple
files at once using clang-format.

A file scheduled to be deleted is signified by a `None` content.

Signed-off-by: Hanno Becker <[email protected]>
- Abort early if a file does not contain any citations.
- Manually wrap long lines rather than invoking clang-format.

Signed-off-by: Hanno Becker <[email protected]>
Manually wrap long comments, and reuse condition parser object.

Signed-off-by: Hanno Becker <[email protected]>
Signed-off-by: Hanno Becker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants