测试程序执行时间
可测试一个或多个函数的执行次数、平均耗时、总耗时,并排序
使用 Babeljs 编译,或者拷贝函数,自己用
使用
yarn add --dev perfomance-js // or npm install --save-dev perfomance-js
参数
p(fns[,num])
- 参数 fns:类型:函数 或 由函数组成的数组
- 参数 num:执行次数,默认为 1
例子
-
一个函数例子
{console} -
多个函数例子
{console}{console}
函数源码
{ const _time = 'time' _start = 'start' _end = 'end' allMeasures = if !Array fns = Array fns allMeasures allMeasures}