attrs

Benchmark created on


Setup

var attrsBaseA = {
	a_serializable: true,
	b_serializable: true,
};
var attrsSubA = {
	b_formerlySerializedAs: 'xx',
	__proto__: attrsBaseA,
};

var attrsBaseB = {
  a: { serializable: true },
  b: { serializable: true },
};
var attrsSubB = {
  b: { formerlySerializedAs: 'xx', __proto__: attrsBaseB.b },
  __proto__: attrsBaseB,
};

var props = [
  ['a', 'serializable'],
  ['b', 'serializable'],
  ['b', 'formerlySerializedAs'],
];

function shuffle() {
	props.sort(() => .5 - Math.random());
}

Test runner

Ready to run.

Testing in
TestOps/sec
A
shuffle();
props.reduce((result, [i, j]) => result += attrsSubB[`${i}_${j}`], '');
ready
B
shuffle();
props.reduce((result, [i, j]) => result += attrsSubB[i][j], '');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.