简体   繁体   中英

Javascript performance test in background

I tried to search for easy method for testing browser performance, everything ended with tools testing performance of code and thats is not my case.

I have site with many CSS/javascript animations triggered with jQuery and I would like to make fallback for browsers/hardware not powerful enough to render it smoothly. On first visit, silent performance background test, save it in cookies and alter behavior of animations based on test result.

Any ideas how?

Would it be enough to use the requestAnimationFrame API to try to smooth out the animations on slower hardware?

If not, the only solution I can think of is to use the most precise timer you have access to in order to determine how long a test animation takes, then decide from there whether to use full animation or not. Not sure if it'd work, but short of giving your users an option to disable animations manually I'm not sure what else you could do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM