Test in operator (v2)

Revision 2 of this benchmark created on


Description

test speed of in operator

Preparation HTML

<script>
var hash = {};
for(var i=0;i<1000;++i){
 hash['a'+i]=i;
}
</script>

Setup

var result = 0;
    var test1 = 'a100';
    var test2 = 'b100';

Test runner

Ready to run.

Testing in
TestOps/sec
in operator
result += hash[test1] ? 1 : 0;
result += hash[test2] ? 1 : 0;
ready
value of
result += (test1 in hash) ? 1 : 0;
result += (test2 in hash) ? 1 : 0;
ready

Revisions

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