search

Home  >  Q&A  >  body text

javascript - Will turning on setInterval in the browser consume performance?

Will turning on setInterval in the browser consume performance? What are the browser and webview scenarios like?

给我你的怀抱给我你的怀抱2746 days ago833

reply all(4)I'll reply

  • 漂亮男人

    漂亮男人2017-05-19 10:17:16

    Remember clearInterval when not in use

    reply
    0
  • 黄舟

    黄舟2017-05-19 10:17:16

    This performance consumption generally has no impact. However, it is quite unpleasant that setInterval has errors. It is recommended to use setTimeout recursion as much as possible.

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-19 10:17:16

    setInterval alone does not consume much. The key is whether there are any expensive operations after the scheduled trigger. To be on the safe side, you should clear it after use.

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-19 10:17:16

    This depends on what you use setInterval for! If you just do some simple operations and nothing happens, and if you keep requesting the interface, the performance will definitely not be very good. Just like what I said on the first floor, remember to clear it if you don’t need it!
    WebView (network view) can load and display web pages and can be regarded as a browser. It uses the WebKit rendering engine to load and display web pages.

    reply
    0
  • Cancelreply