RPG Maker Forums

Hi ..
I find this result quite surprising but also very interesting.
https://jsperf.com/function-calls-direct-vs-apply-vs-call-vs-bind/6
But following this result, I ask myself an anecdotal question.
I would like to reassure myself that I understood the principle of performance.

I use a lot of hud with lots complex animation, and I find myself having to duplicate inside objects, lots of clone function that this repeats from one object to another.
I would purify the codes, but I am falling on this resulta that left me puzzled.
In my context as an example.

So, example here, I have this.

Code:
//1: OUTSIDE: //EXAMPLE STATUS() ARE IN EATCH OBJ
//WHEN GAME BOOT BUILD THIS
$gameVariables.obj1 = new obj1(NewPid);
$gameVariables.obj2 = new obj2(NewPid);
$gameVariables.obj3 = new obj3(NewPid);
//CONSTRUCTOR
function obj1(NewPid) {
    //EXAMPLE STATUS ARE INSIDE EATCH OBJ
    this.Status = function(){if($gameScreen._pictures[this.Pid()]!==undefined){return true;}return false;}
    this.Pid = function() { return this.NewPid }; // RETURN INITIAL PID
}
function obj2(NewPid) {
    //EXAMPLE STATUS ARE INSIDE EATCH OBJ
    this.Status = function(){if($gameScreen._pictures[this.Pid()]!==undefined){return true;}return false;}
    this.Pid = function() { return this.NewPid }; // RETURN INITIAL PID
}
function obj......(NewPid) {
}
//__________________________________________________________________________________________________
//2: OUTSIDE: //EXAMPLE STATUS() ARE NOT IN EATCH OBJ AND ARE CALLED FROM OUTSIDE
GetStatusInObject = function(){
    if($gameScreen._pictures[this.Pid()]!==undefined){return true;}return false;
}
GetStatusInObject.call(obj1);
The second technique is, therefore, cleaner, but much less performance effective in theory?
So the direct method will remain more logical, even if I have to repeat some cloning functions in the constructor. ?
It is not the weight that disturbs me, but rather the performances for access to information

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top