HTML Preparation code:
AخA
 
1
<script>
2
class TestClass {
3
    constructor() {
4
        this.a = 2;
5
  
6
        this.b = 'hello';
7
        this.c = ['some','thing'];
8
        this.d = [1,1,2,3,5,8,13,21];
9
        this.e = 'foofoofoo';
10
        this.f = 'barbarbar';
11
        this.g = {foo:'bar',12:34};
12
        this.h = {nested:{nestedMore:{nestedEvenMore:'nah'}}};
13
  
14
        this.t = 'mesh';
15
    }
16
}
17
</script>
Script Preparation code:
 
var obj = new TestClass();
Tests:
  • instanceof

     
    obj instanceof TestClass;
  • string type

     
    obj.t === 'mesh'
  • string type + undefined

     
    obj.t !== undefined
  • property

     
    obj.a !== undefined
  • constructor comparison

     
    obj.constructor === TestClass
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    instanceof
    string type
    string type + undefined
    property
    constructor comparison

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:78.0) Gecko/20100101 Firefox/78.0
Firefox 78 on Mac OS X 10.11
View result in a separate tab
Test name Executions per second
instanceof 39507116.0 Ops/sec
string type 86508840.0 Ops/sec
string type + undefined 34966680.0 Ops/sec
property 33149456.0 Ops/sec
constructor comparison 40121508.0 Ops/sec