hexops / vecty

Vecty lets you build responsive and dynamic web frontends in Go using WebAssembly, competing with modern web frameworks like React & VueJS.
BSD 3-Clause "New" or "Revised" License
2.82k stars 144 forks source link

in GopherJS, vecty.Rerender should perhaps invoke runtime.Gosched itself #212

Closed slimsag closed 4 years ago

slimsag commented 6 years ago

When calling vecty.Rerender in tight loops, it is possible for GopherJS to not give any run time to the internal Vecty rendering goroutine and as such vecty.Rerender looks like it does nothing.

For example, see this conversation in Slack about updating a progress bar loader: https://gophers.slack.com/archives/C0LBM1R0C/p1536229658000100

We can avoid this by adding a call to runtime.Gosched implicitly in vecty.Rerender which would probably be fine (and scoped only to GopherJS implementation, not WebAssembly)

dmitshur commented 6 years ago

Should it be the responsibility of libraries to do this? Is it harmless if user also does it?

An alternative to consider is documenting this.

If this is a short/medium-term workaround for GopherJS only, then perhaps it's fine to optimize for that.

(I'm not against this, just wanted to ask some questions.)

slimsag commented 4 years ago

Closing as https://github.com/hexops/vecty/issues/264 removes explicit support for things such as this.