property static vs symbol access speed (v2)

Revision 2 of this benchmark created on


Setup

const aSymbol = Symbol.for('test');
function FNStatic(){}
FNStatic.aStatic = Math.random();

function FNSymbol(){}
FNSymbol[aSymbol] = Math.random();

function FNNumber(){}
FNNumber[0] = Math.random();

let result = 0;
const iter = 100;

Test runner

Ready to run.

Testing in
TestOps/sec
static
result = 0;
for(let i=0;i<iter;i++){
result += FNStatic.aStatic;
}
ready
symbol
result = 0;
for(let i=0;i<iter;i++){
result += FNSymbol[aSymbol];
}
ready
number
result = 0;
for(let i=0;i<iter;i++){
result += FNNumber[0];
}
ready

Revisions

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