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

Optimising codegen using an asynchronous client and pipelining #215

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Virgiel
Copy link
Member

@Virgiel Virgiel commented May 24, 2023

When benchmarking codegen, I found that we spent most of our time communicating with the database synchronously to prepare each query one by one. By using an asynchronous client and relying on pipelining, codegen's time went from 22ms to 6ms on my machine.

@Virgiel
Copy link
Member Author

Virgiel commented May 25, 2023

When we generate code against a managed database, most of our time is spent on docker commands, 1.3s when managed vs 50ms when live. We don't have an easy way to improve this.

Parsing is also an expensive CPU task that we can parallelize by module, but the gain is less: 6ms down to 4ms. Finally, we could also use mmap instead of reading queries and schema files into memory for even smaller but easy gain.

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.

1 participant