-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Call() has terrible performance (for a certain definition of "terrible" - i'm writing a WebGL thing and it's bad enough to matter). It has to pass the method name from wasm to JS each time, and decode it from bytes into a UTF8 string each time: golang/go#32591 (comment)
A potential solution would be to cache functions for each object (either on creation or on invocation). Properties referencing functions in JS web API objects tend to be readonly (in fact i'm fairly sure they always are, would love to find a counterexample), so there shouldn't be any issues with an outdated value in cache. Then instead of using Call() on the object, use an Invoke() on the cached function.
(Don't forget to Bind() the function first, like i just did)
Metadata
Metadata
Assignees
Labels
No labels