Is setInterval CPU intensive?

前端 未结 6 987
长情又很酷
长情又很酷 2020-11-29 04:14

I read somewhere that setInterval is CPU intensive. I created a script that uses setInterval and monitored the CPU usage but didn\'t notice a change. I want to know if there

6条回答
  •  眼角桃花
    2020-11-29 05:04

    In your case there will not be any issue. But if your doing some huge animations in canvas or working with webgl , then there will be some CPU issues, so for that you can use requestAnimationFrame.

    Refer this link About requestAnimationFrame

提交回复
热议问题