symbol-perf

Benchmark created by PetkaAntonov on


Preparation HTML

<script>
window.constantSymbol = Symbol("asd");
window.variableSymbol = Symbol("asd");

function blind() {
    /*you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
you cannot know what this function does
*/
}
function Obj() {
    this.field = 3;
    this[constantSymbol] = 3;
    this[variableSymbol] = 3;
}
var theObject = new Obj();
</script>

Setup

var symbol = variableSymbol;
    var theValue = 3;
    
    (function() {
       theValue; symbol;
    });

Test runner

Ready to run.

Testing in
TestOps/sec
field
if (theObject.field !== theValue) die
blind();
ready
constant-symbol
if (theObject[constantSymbol] !== theValue) die
blind();
ready
closure-symbol
if (theObject[symbol] !== theValue) die
blind();
ready

Revisions

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

  • Revision 1: published by PetkaAntonov on