-
Notifications
You must be signed in to change notification settings - Fork 79
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
wasm32-wasi stability/production-readiness (tests) #351
Comments
Hey! I consider the wasm target to be pretty stable, it is marked as not tested as I don't have any CI set up to run the rquickjs test on a wasm platform. That said rquickjs is used in javy a tool for running javascript in wasm from the wasmtime people which I take as a pretty good endorsement. In general I think rquickjs itself is also pretty stable/production ready. It is used by some relatively large projects like SurrealDB and LLRT which seem to use it without much problems. I however don't think this library will every be fully semver stable as it is tied to QuickJS which doesn't follow semver and could introduce some large changes which rquickjs will have to respond to. |
Hi, how involved would it be to get the CI set up to run the rquickjs tests on wasm32-wasi? We would like to go production-ready with our framework which uses rquickjs, but would love to see this test suite passing first. |
We might be able to do a PR for this with some guidance |
I consider a platform tested in the table if the rust tests are run in CI. So we would need some way to run these tests in web-assembly. I haven't had the time to look into how to do that. CI would have to compile all those test to web assembly and then run those in some wasm runtime. There might be some tools already out there to do that, I know wasm-pack has the ability to run tests in wasm but that is specifically for the browser. |
I'm going to attempt to get the |
Alright here is the PR, opened as a draft, for some feedback: #441 I've left my main questions as a comment in the PR. @DelSkayn I am very eager for your feedback and to get this merged, as we would like to consider |
In addition to my PR @DelSkayn, I have another question about production-readiness. Is We kind of just scatter this code throughout our codebase where we think it makes sense... pub fn run_event_loop(ctx: Ctx) {
while ctx.execute_pending_job() {}
} Is there a danger to calling |
One more thing: can we use If this is possible, are there tests? I would like a test suite for this in the Wasm targets ideally. |
I want to confirm that |
In our environment, we have requests coming in essentially to a Wasm server environment (Internet Computer Protocol), and when a request comes in we execute a JavaScript function within one At the end of each request, after the JavaScript function is executed to completion, we call Essentially we attempt to run Does this sound correct? Is running |
QuickJS itself implements the event loop, Within QuickJS the 'event loop' is just a linked list of pending jobs. Whenever a promise or something similar is created it will be pushed onto the list and then ran whenever JS_ExecutePendingJob is called. I don't think there is any issue with calling it frequently. |
That should be possible, if it isn't than it might be a bug. |
That seems like a fine approach I don't see much anything wrong with it.
QuickJS by default only has micro-tasks. If I remember the terms correctly micro-tasks are promises and suchs and macros-tasks are incoming events like in the browser click events and setTimeout. QuickJS does not implement setTimeout or any functionality which results in events like IO so there are no macro tasks. Calling |
Hi,
I'm highly considering integrating rquickjs into our project. We need a stable/production-ready QuickJS bindings in Rust for the wasm32-wasi target.
I was looking at the Supported Platforms and wasm32-wasi is indeed supported...but the table says that the target has not been tested.
A few questions (with some implied requests):
The text was updated successfully, but these errors were encountered: