12. 벤치마킹과 튜닝
주요내용
Benchmark.js
// 공식사이트 샘플 예제
var suite = new Benchmark.Suite;
// add tests
suite.add('RegExp#test', function() {
/o/.test('Hello World!');
})
.add('String#indexOf', function() {
'Hello World!'.indexOf('o') > -1;
})
.add('String#match', function() {
!!'Hello World!'.match(/o/);
})
// add listeners
.on('cycle', function(event) {
console.log(String(event.target));
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').map('name'));
})
// run async
.run({ 'async': true });jsPerf.com
미세성능
똑같은 엔진은 없다
v8 작동 원리를 최대한 활용한 코딩방식
꼬리호출 최적화(TCO)
Last updated