Tests:
  • bind

    x
     
    function fn1() {
        return 1 + 1;
    }
    function fn2() {
        return 2 + 2;
    }
    function fn3() {
        return 3 + 3;
    }
    function fn4() {
        return 4 + 4;
    }
    function createSomething() {
        return [fn1.bind(), fn2.bind(), fn3.bind(), fn4.bind()]
    }
    for (let i = 0; i < 100; i++) {
        let [a, b, c, d] = createSomething();
        for (let j = 0; j < 100; j++) {
            a();
            b();
            c();
            d();
        }
    }
  • closure

     
    function createSomething() {
        function fn1() {
            return 1 + 1;
        }
        function fn2() {
            return 2 + 2;
        }
        function fn3() {
            return 3 + 3;
        }
        function fn4() {
            return 4 + 4;
        }
        return [fn1, fn2, fn3, fn4]
    }
    for (let i = 0; i < 100; i++) {
        let [a, b, c, d] = createSomething();
        for (let j = 0; j < 100; j++) {
            a();
            b();
            c();
            d();
        }
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    bind
    closure

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 OPR/116.0.0.0
Opera 116 on Windows
View result in a separate tab
Test name Executions per second
bind 2878.7 Ops/sec
closure 213265.6 Ops/sec