I have a worker in development that uses web assembly (compiled from rust).
To avoid excess CPU, I tried using a global variable to reuse a struct setup in a preview request. The worker now fails with “script exceeded time limit”.
The struct should be extremely small (in theory, I know wasm can in inefficient with memory) so this is very surprising.
There’s a PR showing the change at https://github.com/samuelcolvin/edgerender/pull/1
Can anyone explain this or point me to how to fix this?
Feel free to reply here or on github.
Update: I’m guessing this is because the
Is that correct? If so is there any way to tell prevent the wasm struct from being destroyed between requests?
Update 2: I see the error is happening on
await wasm_bindgen(wasm), not when accessing