-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathperformance.js
More file actions
22 lines (15 loc) · 776 Bytes
/
performance.js
File metadata and controls
22 lines (15 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const stampit = require('stampit');
const InterfaceCheck = require('./index');
const EmptyStamp = stampit();
const RUNS = 10000;
const composables = [{name: 'InterfaceCheck', stamp: InterfaceCheck}, {name: 'EmptyStamp', stamp: EmptyStamp}];
composables.forEach((composable) => {
"use strict";
const hrstart = process.hrtime();
for (let i = 0; i < RUNS; i++) {
let Interface = stampit().compose(composable.stamp).methods({foo: () => {}, bar: () => {}, baz: () => {}});
stampit().compose(Interface).methods({foo: () => {/**/}, bar: () => {/**/}, baz: () => {/**/}})();
}
const hrend = process.hrtime(hrstart);
console.info("%ds %dms execution time for %s", hrend[0], hrend[1]/1000000, composable.name);
});