Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up code generation in split_generated_files mode #542

Open
Millione opened this issue Dec 6, 2024 · 3 comments
Open

Speed up code generation in split_generated_files mode #542

Millione opened this issue Dec 6, 2024 · 3 comments
Labels
A-volo-build This issue concerns the `volo-build` crate. C-enhancement This is a PR that adds a new feature or fixes a bug.

Comments

@Millione
Copy link
Member

Millione commented Dec 6, 2024

Previously @missingdays supported split_generated_files mode to solve #454, but users reported that the generation speed was 3-4 times slower than the previous mode, and the total number of lines of generated code increased by about 20%.

Such a slowdown for large projects is indeed unacceptable, we need to investigate to find out where the slowdown is and how to fix it.

@Millione Millione added A-volo-build This issue concerns the `volo-build` crate. C-enhancement This is a PR that adds a new feature or fixes a bug. labels Dec 6, 2024
@Millione
Copy link
Member Author

Millione commented Dec 6, 2024

@missingdays Hi, as you suggested, we can tracking the issue here.

FYI: There's no detailed time analysis yet, but my guess is that it's mainly slow in creating, writing and formatting files, too many operations like this in split_generated_files mode

@missingdays
Copy link
Contributor

@Millione Hi. Should we start with the measurements? With the generation taking several seconds, a simple

    let start = Instant::now();
    generate();
    let duration = start.elapsed();

should be precise enough.
It could measure the total execution time, as well as the time spent on each operation deemed expensive (e.g. file writing or formating). Then the measurements could be put into some sort of log.

@Millione
Copy link
Member Author

@missingdays Totally agree, you can implement it on your branch and when you're ready I'll run it on the internal repository to get all the data we need. Then we can work on optimising it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-volo-build This issue concerns the `volo-build` crate. C-enhancement This is a PR that adds a new feature or fixes a bug.
Development

No branches or pull requests

2 participants