Coder Social home page Coder Social logo

task-slice's Introduction

任务切片

这是一个用来性能优化的工具,如果项目中存在 long task 的任务,可以采用此工具来做性能优化

核心**

用户在感知每秒 60 帧(也就是 16.7 毫秒)时候,动画是平滑过渡的

在如果出现少于 60 帧动画的时候,就会感觉到卡顿,影响卡顿的原因有一部分就是因为 long task 导致的

这个工具的目的,就是用来解决长任务

安装

npm install task-slice

使用方式

import TaskSlice from 'TaskSlice'

TaskSlice.init(number, function(i){
    //i 执行到第几次,或者第几个切片任务
})

亲测数据对比

左侧的是优化前,右侧的是优化后

版本更新记录

版本 时间 详情
v1.0.3 2019-8-4 添加demo
v1.0.2 2019-7-23 去除对数组的支持,仅支持数字方式,原来通过 callback 获取的数组项可通过 callback 返回的索引去直接获取,减少代码不是刚需的兼容,提升工具库执行效率
v1.0.1 2019-7-20 格式化README
v1.0.0 2019-7-20 正式版上线

task-slice's People

Contributors

nextdooruncleliu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.