-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
329 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
/* globals suite benchmark */ | ||
import {benchSettings} from 'karma-webpack-bundle'; | ||
import Cache from '../lib/cache.js'; | ||
import {suite} from './utils.js'; | ||
|
||
let temporaryTarget; | ||
|
||
suite('Cache init', () => { | ||
benchmark('init', () => { | ||
temporaryTarget = new Cache(); | ||
}, benchSettings); | ||
|
||
benchmark('getProxy', () => { | ||
temporaryTarget = new Cache(); | ||
temporaryTarget.getProxy({}, '', {}); | ||
}, benchSettings); | ||
await suite('Cache init', bench => { | ||
bench | ||
.add('init', () => { | ||
temporaryTarget = new Cache(); | ||
}) | ||
.add('getProxy', () => { | ||
temporaryTarget = new Cache(); | ||
temporaryTarget.getProxy({}, '', {}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
await import('./main.bench.js'); | ||
await import('./array.bench.js'); | ||
await import('./cache.bench.js'); | ||
await import('./is-builtin.bench.js'); | ||
await import('./path.bench.js'); | ||
await import('./smart-clone.bench.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,42 @@ | ||
/* globals suite benchmark */ | ||
import {benchSettings} from 'karma-webpack-bundle'; | ||
import {isBuiltinWithMutableMethods, isBuiltinWithoutMutableMethods} from '../lib/is-builtin.js'; | ||
import {suite} from './utils.js'; | ||
|
||
let temporaryTarget; // eslint-disable-line no-unused-vars | ||
|
||
suite('isBuiltinWithMutableMethods', () => { | ||
await suite('isBuiltinWithMutableMethods', bench => { | ||
const date = new Date(); | ||
const notDate = 'a'; | ||
|
||
benchmark('date', () => { | ||
temporaryTarget = isBuiltinWithMutableMethods(date); | ||
}, benchSettings); | ||
|
||
benchmark('not date', () => { | ||
temporaryTarget = isBuiltinWithMutableMethods(notDate); | ||
}, benchSettings); | ||
bench | ||
.add('date', () => { | ||
temporaryTarget = isBuiltinWithMutableMethods(date); | ||
}) | ||
.add('not date', () => { | ||
temporaryTarget = isBuiltinWithMutableMethods(notDate); | ||
}); | ||
}); | ||
|
||
suite('isBuiltinWithoutMutableMethods', () => { | ||
await suite('isBuiltinWithoutMutableMethods', bench => { | ||
const testNaN = Number.NaN; | ||
const testRegExp = /as/g; | ||
const testString = 'a'; | ||
const testNumber = 42; | ||
const testNumberInstance = Number(42); | ||
|
||
benchmark('NaN', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testNaN); | ||
}, benchSettings); | ||
|
||
benchmark('regexp', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testRegExp); | ||
}, benchSettings); | ||
|
||
benchmark('string', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testString); | ||
}, benchSettings); | ||
|
||
benchmark('number', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testNumber); | ||
}, benchSettings); | ||
|
||
benchmark('number instance', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testNumberInstance); | ||
}, benchSettings); | ||
bench | ||
.add('NaN', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testNaN); | ||
}) | ||
.add('regexp', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testRegExp); | ||
}) | ||
.add('string', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testString); | ||
}) | ||
.add('number', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testNumber); | ||
}) | ||
.add('number instance', () => { | ||
temporaryTarget = isBuiltinWithoutMutableMethods(testNumberInstance); | ||
}); | ||
}); |
Oops, something went wrong.