property static vs symbol access speed

Benchmark created on


Setup

const aSymbol = Symbol.for('test');
function FN(){}
FN.aStatic = Math.random();
FN[aSymbol] = 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 += FN.aStatic;
}
ready
symbol
result = 0;
for(let i=0;i<iter;i++){
result += FN[aSymbol];
}
ready

Revisions

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