测试代码耗时
- 对代码时长进行测试,通过对比来进行优化
- 返回值是ms,可自行进行单位优化
传入参数需保持一致,否则报:
Timer '你起的不同的名字' does not exist
//前面的代码
console.time('howManyTime')
// 这里是你想要测试时长的代码
console.timeEnd('howManyTime')
//后面的代码
js测试代码执行时间
传入参数需保持一致,否则报:
Timer '你起的不同的名字' does not exist//前面的代码
console.time('howManyTime')
// 这里是你想要测试时长的代码
console.timeEnd('howManyTime')
//后面的代码


