wasmerio / winterjs

Winter is coming... ❄️
https://winterjs.org/
MIT License
3.04k stars 53 forks source link

Re-use JS runtime for multiple requests #1

Closed theduke closed 1 year ago

theduke commented 1 year ago

Currently a new JS runtime is initialized per request.

We need to use a single runtime to process requests in parallel.

Easy way to do it:

Arshia001 commented 1 year ago

But won't running multiple functions on the same runtime lead to stuff like static variables not being cleaned up between function invocations etc.? Are we sure we want to create that kind of error scenario for the users?

syrusakbary commented 1 year ago

Extra information (reused proc macro?): https://github.com/Redfire75369/spiderfire/tree/master

theduke commented 1 year ago

Are we sure we want to create that kind of error scenario for the users?

The performance difference will be huge. I think this should be expected, it's how regular servers behave.