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

Improve build times by generating less IR #1192

Merged
merged 12 commits into from Jul 25, 2022
Merged

Improve build times by generating less IR #1192

merged 12 commits into from Jul 25, 2022

Conversation

davidpdrsn
Copy link
Member

I used cargo-llvm-lines to find functions that generates lots of IR and tweaked them (mostly by making inner functions) to generate less. The biggest offender was MethodRouter::merge.

I tested on a small example with a couple of routes and some middleware and this shaved ~1 second of the clean debug build time (12 seconds to 11 seconds) and a 3% reduction in IR.

@davidpdrsn davidpdrsn requested a review from jplatte July 25, 2022 15:44
axum/src/routing/method_routing.rs Outdated Show resolved Hide resolved
axum/src/routing/method_routing.rs Show resolved Hide resolved
@davidpdrsn davidpdrsn enabled auto-merge (squash) July 25, 2022 17:57
@davidpdrsn davidpdrsn merged commit 234c8cc into main Jul 25, 2022
@davidpdrsn davidpdrsn deleted the generate-less-ir branch July 25, 2022 18:06
davidpdrsn added a commit that referenced this pull request Jul 25, 2022
* example

* `MethodRouter::merge`

* `set_content_length` and `set_allow_header`

* `MethodRouter::on_service_boxed_response_body`

* `Router::route`

* `MethodRouter::merge` again

* `MethodRouter::on_service_boxed_response_body`

* `Router::call_route`

* `MethodRouter::{layer, route_layer}`

* revert example

* fix test

* move function to method on `AllowHeader`
davidpdrsn added a commit that referenced this pull request Jul 25, 2022
Backports these PRs to 0.5.x

- #1192
- #1185
- #1178
- #1171
@davidpdrsn davidpdrsn mentioned this pull request Jul 25, 2022
davidpdrsn added a commit that referenced this pull request Jul 25, 2022
Backports these PRs to 0.5.x

- #1192
- #1185
- #1178
- #1171
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.

None yet

2 participants