Test

Benchmark created on


Setup

function useCachedThis () {
        var _this = this;
        for ( var i = 0; i < 1000; i++ ) {
            _this.x = _this.x + _this.y;
        }
    }
    
    function useThis () {
        for ( var i = 0; i < 1000; i++ ) {
            this.x = this.x + this.y;
        }
    }
    
    var obj = {x:1,y:1};

Test runner

Ready to run.

Testing in
TestOps/sec
Cached This
useCachedThis.call( obj );
ready
Direct This
useThis.call( obj );
ready

Revisions

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