zoukankan      html  css  js  c++  java
  • 深入理解javascript事件

    使用setInterval调度

       1:      var fireCount = 0;
       2:      var start = new Date;
       3:      var timer = setInterval(function() {
       4:        if (new Date - start > 1000) {
       5:   
       6:          clearInterval(timer)
       7:          console.log('setInterval 1000ms运行次数' + fireCount + "次数");
       8:          return
       9:        }
      10:        fireCount++;
      11:      }, 0)

    1秒钟运行次数
    Safari 224

    image

    Google Chrome 189

    image

    HTML规范,推行的延时/时间间隔的最小值是4毫秒

    http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html

    • node中,pocess.nextTick 可以超过10万次/秒
    • requestAnimationFrame
        1. 允许60+帧/秒的速度运行动画

        2. 避免后台选项卡运行这些动画,节约CPU周期

  • 相关阅读:
    vector、list、deque三者比较
    python多线程
    爬虫入门之线程进程协程抓取方法(八)
    爬虫之绘图matplotlib与词云(七)
    python字符串反转 高阶函数 @property与sorted(八)
    爬虫入门之Requests模块学习(四)
    爬虫入门之handler与opener(三)
    mongodb/python3.6/mysql的安装
    nginx配置+uwsgi+负载均衡配置
    [JLOI2016] 成绩比较
  • 原文地址:https://www.cnblogs.com/aaronjs/p/3158474.html
Copyright © 2011-2022 走看看