Benchmark performance test [bind,self,call]

this is a rare little functional test that gives performance not to creation but to execution.
it works this way, assuming you have initialize all methods in your project.
PHP:
var self = this;
var test_call = test.call(self);
var test_bind = test.bind(self);
var test_self = function() { return self; };
the result is very interesting.
rmmv 1.5 are based on chromium 41, but we can take performance to the 48.
Note rmmv 1.6 will have 61>.
Sans-titre-1.png


we can note that it is necessary at all costs to avoid the .bind || .call if not necessary
And winner are closures
to detriment fattening the memory, which is not critical especially in a video game and also if you if you increase the memory allocated to the project.

example : it more optimal to write like this
PHP:
    var doAction = (function(motion,ease,_actions){
        return (function(){
           // ease.doStuff()
        })
    })(motion,ease,this.actions);

than like this
PHP:
    var doAction = (function(motion,_actions){
        return (function(){
           // this.doStuff()
        }).bind(ease)
    })(motion,this.actions);


I often ask myself this question, now I have my answer.

you can test this benchmark here setup 57
https://jsperf.com/bind-vs-closure-setup/57
note: that the core rmmv are specialized in .call() and .bind() and especially in the updates. No wonder to have lags even with a pc gamer!!!

Original thread: https://forums.rpgmakerweb.com/threads/benchmark-performance-test-bind-self-call.89879/