Tests:
  • Object Property

    x
     
    class Bar {
        constructor() {
            this.prop = {
                foo: function() {
                    console.log('foo!')
                }
            }
        }
        test() {
            if(this.prop.foo) {
                this.prop.foo()
            }
        }
    }
    const b = new Bar()
    b.test()
  • Local Variable

     
    class Bar {
        constructor() {
            this.prop = {
                foo: function() {
                    console.log('foo!')
                }
            }
        }
        test() {
            const foo = this.prop.foo
            if(foo) {
                foo()
            }
        }
    }
    const b = new Bar()
    b.test()
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object Property
    Local Variable

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0
Chrome 133 on Windows
View result in a separate tab
Test name Executions per second
Object Property 32118.4 Ops/sec
Local Variable 32403.9 Ops/sec