31
Technical forum / performance issue - method function calls for objects
« on: September 23, 2008, 04:06:56 PM »
Hey
I have this perfomance issue.
I want to call a method function in an entity object several times, and i see a bad performance behaviour. I tried profiling it :
this is in the actor:
and this is the code in MyBaloonEnt's script:
now this is the output:
18:04:19: Before BaloonEn8878
18:04:19: BalloonEnt StopTalking entry8878
18:04:19: BalloonEnt StopTalking Leave8878
18:04:19: After MyBaloonEnt 8935
For some reason - there's about 60ms going to waste everytime there's a transition between two scripts.
Ordinarily that wouldn't be a problem - but in my case there is because i'm doing this thing in a loop.
Why is this happening ? Any suggestions ?
I would rather keep my functions implemented there in object and not have .inc files just to have inline functions
I have this perfomance issue.
I want to call a method function in an entity object several times, and i see a bad performance behaviour. I tried profiling it :
this is in the actor:
Code: [Select]
Game.LOG("Before BaloonEnt " + Game.CurrentTime);
MyBaloonEnt.StopTalking();
Game.LOG("After MyBaloonEnt " + Game.CurrentTime);
and this is the code in MyBaloonEnt's script:
Code: [Select]
method StopTalking()
{
Game.LOG("BalloonEnt StopTalking entry" + Game.CurrentTime);
this.StopTalkingReq = true;
//this.SetTalkSprite("actors\NullAct\null.sprite");
this.StopTalking();
Game.LOG("BalloonEnt StopTalking Leave" + Game.CurrentTime);
}
now this is the output:
18:04:19: Before BaloonEn8878
18:04:19: BalloonEnt StopTalking entry8878
18:04:19: BalloonEnt StopTalking Leave8878
18:04:19: After MyBaloonEnt 8935
For some reason - there's about 60ms going to waste everytime there's a transition between two scripts.
Ordinarily that wouldn't be a problem - but in my case there is because i'm doing this thing in a loop.
Why is this happening ? Any suggestions ?
I would rather keep my functions implemented there in object and not have .inc files just to have inline functions