sagemathinc / cowasm

CoWasm: Collaborative WebAssembly for Servers and Browsers. Built using Zig. Supports Python with extension modules, including numpy.

Home Page:https://cowasm.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reusable interpreters by save/restore state

pauleveritt opened this issue · comments

As background, I have a long tutorial about test-first development for browser-Python with Vitest. It has a section on speeding up test runs to use one interpreter instance for all tests.

I'm interested in writing a variation of that tutorial, using cowasm. Does it have a story for resetting an interpreter to a known, saved state in NodeJS?

As an aside, can you have multiple interpreters, in Node and/or browser?

Does it have a story for resetting an interpreter to a known, saved state in NodeJS?

Not really. I could potentially see how to implement that if the state is a "waiting for input from the user" state, but it's certainly not implemented.

As an aside, can you have multiple interpreters, in Node and/or browser?

Yes, definitely, that works very well. Each has their own isolated state in a Worker thread, and they can run in parallel. This does work in pretty much the same way in both node and the browser.

Thanks for the fast response. I wonder if I could get faster testing with a pool of pre-warmed interpreters.

I'll go ahead and close this.