Skip to content

Go 1.18 drops syscall.js.Wrapper #15

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

Closed
janpfeifer opened this issue Jan 9, 2022 · 2 comments
Closed

Go 1.18 drops syscall.js.Wrapper #15

janpfeifer opened this issue Jan 9, 2022 · 2 comments
Assignees

Comments

@janpfeifer
Copy link
Collaborator

Because of performance reasons Go is dropping js.Wrapper. I noticed this today, as I was trying out the 1.18.1 beta.

I suspect it should be an easy fix, but I haven't yet dived into it. Hopefully the fix will be backwards compatible -- since it only removed functionality.

I'll try to do post benchmarking in a wasm game I occasionally develop.

@janpfeifer
Copy link
Collaborator Author

The fix is simple, but unfortunately I couldn't find a way not to break the API one way or another :\ So the *fromJS() methods will take js.Value. So from the examples, one cannot use something like a dom.Element as input to *FromJS() methods. Instead I'm adding the *FromWrapper() methods that will allow for that.`.

Fix seems to be working on all tests, both in go1.17 and go1.8.beta1 -- so the webapi will work on both versions of Go.

I'm also adding go.mod.

(I'll post the PR soon)

@janpfeifer janpfeifer self-assigned this Jan 10, 2022
janpfeifer added a commit to janpfeifer/webapi that referenced this issue Jan 10, 2022
… should allow for an easy fix using the new `*FromWrapper()` methods. See issue gowebapi#15
@janpfeifer
Copy link
Collaborator Author

The change is in, and seems to be working here (tests passing, and working in my WebGL application).

I also benchmarked on my WASM+WebGL game the time it took to draw a typical scene (maybe a thousand moving sprites), and it takes 10ms (only the drawing), and the difference from go 1.17 and go 1.18 was in the noise (lots of variance in the metric). Informally it felt go 1.18 was 0.5ms faster ... but certainly in the noise of my measure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant