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

Generate Python code via a WASM plugin #1414

Closed
wants to merge 13 commits into from
Closed

Conversation

kyleconroy
Copy link
Collaborator

@kyleconroy kyleconroy commented Feb 5, 2022

Based on #1406 and https://github.com/kyleconroy/go-wasm-plugins, this is a working, proof-of-concept implementation of generating code via a WASM plugin. It generates the same Python code, but over 10x slower!

$ time WASMTIME_BACKTRACE_DETAILS=1 sqlc-dev generate --experimental

real	0m0.035s
user	0m0.028s
sys	0m0.011s
Kyles-MacBook-Air:python kyle$ time WASM=1 WASMTIME_BACKTRACE_DETAILS=1 sqlc-dev generate --experimental

real	0m0.955s
user	0m0.932s
sys	0m0.027s

EDIT: After reading over the docs, I implemented module caching be serializing the module after initializing it from the WASM. This significantly sped up module initialization, to the point where the WASM version is barely slower.

time WASM=1 WASMTIME_BACKTRACE_DETAILS=1 sqlc-dev generate --experimental

real	0m0.055s
user	0m0.044s
sys	0m0.017s

@kyleconroy kyleconroy marked this pull request as draft February 5, 2022 06:33
@kyleconroy kyleconroy changed the title Kyle/python wasm plugin Generate Python code via a WASM plugin Feb 5, 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.

None yet

1 participant