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

Make a note about sqlx macros opt level #1685

Conversation

CosmicHorrorDev
Copy link
Contributor

Changing this build setting made cargo check over twice as fast on a project I work on. I didn't see this mentioned anywhere in the documentation for this project, so I figured it was worth adding a note

@abonander
Copy link
Collaborator

I've tried setting RUSTFLAGS=-C opt-level=3 in the past but it didn't really seem to help despite forcing a recompile of the entire dependency tree. I think I tried this exact trick as well, in sqlx-macros itself, and it also didn't really help. I'll try it again though.

It may also depend on whether you're compiling against a database running on the same machine or not, as when I accidentally compile against a hosted database in the cloud rather than a local machine, it easily takes several orders of magnitude longer, likely due to hitting more of Tokio's I/O driver code which is also not optimized when building in debug mode.

@CosmicHorrorDev
Copy link
Contributor Author

It's possible this won't make a significant difference after #1684. The situation where I noticed a large speedup was from cargo check times with a lot of queries and a relatively large sqlx-data.json file, but testing again after #1864 was applied led to less than a 0.2 second difference. Using a remote db and local db both show basically the same time.

If you want you can close this in favor of #1684. I figured there would be a significant difference when using a remote db too, but that doesn't seem to be the case

@abonander abonander merged commit 5f7e25b into launchbadge:master Feb 16, 2022
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.

2 participants