Skip to content

Commit

Permalink
squash
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Oct 18, 2016
1 parent 8b75639 commit 15bd927
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions benchmark/es/map-bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ const assert = require('assert');

const bench = common.createBenchmark(main, {
method: ['object', 'nullProtoObject', 'fakeMap', 'map'],
millions: [10]
thousands: [100]
});

function runObject(n) {
const m = {};
var i = 0;
bench.start();
for (; i < n; i++) {
m['i' + n] = n;
m['s' + n] = String(n);
assert.equal(m['i' + n], m['s' + n]);
m['i' + n] = undefined;
m['s' + n] = undefined;
m['i' + i] = i;
m['s' + i] = String(i);
assert.equal(m['i' + i], m['s' + i]);
m['i' + i] = undefined;
m['s' + i] = undefined;
}
bench.end(n / 1e6);
}
Expand All @@ -27,11 +27,11 @@ function runNullProtoObject(n) {
var i = 0;
bench.start();
for (; i < n; i++) {
m['i' + n] = n;
m['s' + n] = String(n);
assert.equal(m['i' + n], m['s' + n]);
m['i' + n] = undefined;
m['s' + n] = undefined;
m['i' + i] = i;
m['s' + i] = String(i);
assert.equal(m['i' + i], m['s' + i]);
m['i' + i] = undefined;
m['s' + i] = undefined;
}
bench.end(n / 1e6);
}
Expand All @@ -51,11 +51,11 @@ function runFakeMap(n) {
var i = 0;
bench.start();
for (; i < n; i++) {
m.set('i' + n, n);
m.set('s' + n, String(n));
assert.equal(m.get('i' + n), m.get('s' + n));
m.set('i' + n, undefined);
m.set('s' + n, undefined);
m.set('i' + i, i);
m.set('s' + i, String(i));
assert.equal(m.get('i' + i), m.get('s' + i));
m.set('i' + i, undefined);
m.set('s' + i, undefined);
}
bench.end(n / 1e6);
}
Expand All @@ -65,17 +65,17 @@ function runMap(n) {
var i = 0;
bench.start();
for (; i < n; i++) {
m.set('i' + n, n);
m.set('s' + n, String(n));
assert.equal(m.get('i' + n), m.get('s' + n));
m.set('i' + n, undefined);
m.set('s' + n, undefined);
m.set('i' + i, i);
m.set('s' + i, String(i));
assert.equal(m.get('i' + i), m.get('s' + i));
m.set('i' + i, undefined);
m.set('s' + i, undefined);
}
bench.end(n / 1e6);
}

function main(conf) {
const n = +conf.millions * 1e6;
const n = +conf.thousands * 1000;

switch (conf.method) {
case 'object':
Expand Down

0 comments on commit 15bd927

Please sign in to comment.