Skip to content
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

Should we care about requestAnimationFrame? #90

Closed
jorgebucaran opened this issue Feb 15, 2017 · 5 comments
Closed

Should we care about requestAnimationFrame? #90

jorgebucaran opened this issue Feb 15, 2017 · 5 comments
Milestone

Comments

@jorgebucaran
Copy link
Owner

jorgebucaran commented Feb 15, 2017

The initial commit of hyperapp demonstrates how to use [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame to batch view renderings, largely based in Raynos/main-loop.

At the time, I was using Matt-Esch/virtual-dom, but when I moved to Snabbdom I dropped this in favor of whatever Snabbdom was doing. Now that we're using a in-house vdom algorithm, it is worth considering using requestAnimationFrame again.

Ideally this would come after #75.

@FlorianWendelborn
Copy link

I think it's a good idea. Depending on the effects used the state might be updated more than 60 times per second, which would probably lead to high CPU usage, etc.

E.g. I planned to use hyperapp when re-writing @smartflat. It'd easily be possible to get more than 60 sensor updates per second in that particular project.

@terkelg
Copy link
Contributor

terkelg commented Feb 15, 2017

Always nice with performance optimisations and I think no matter what we should provide examples on how to do this in the documentation.

Personally I'd prefer not to have it included, because I often work on projects that involve a lot of canvas, WebGL, tweening etc. and to avoid multiple requestAnimationFrame all over the place I just have a single main loop, which all other code subscribe to.

That being said, I guess it's in most peoples interest to have stuff like this included out of the box and it's what most virtual dom implementations do. It could be fun to do some performance testing, and see how much it actually does for the performance.

@dodekeract @smartflat looks really interesting! Nice one.

@jorgebucaran
Copy link
Owner Author

It could be fun to do some performance testing, and see how much it actually does for the performance.

This. I haven't had time to work on new benchmarks since http://mathieuancelin.github.io/js-repaint-perfs/hyperapp/, but I also want to see how much it would mean for performance.

@jorgebucaran
Copy link
Owner Author

@jorgebucaran
Copy link
Owner Author

Close in favor of #286.

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

No branches or pull requests

3 participants