• Advertisement
Sign in to follow this  

Context.Prepare

This topic is 4818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I'm currently trying to squeeze out performance from my app. I wonder if calling Prepare() is needed every time a script function is called or if its enough to call Prepare just once if I keep the context after the script returned? Regards Tom

Share this post


Link to post
Share on other sites
Advertisement
It is necessary to call Prepare() to reset the context before starting the execution again.

I could make Prepare() a little smarter by verifying if it is the same function ID that is being passed, and if so use the information that is already known. That would save a little overhead, where bytecode address is fetched, and stack space is verified, etc.

Share this post


Link to post
Share on other sites
Ok, thanks
I just want to make sure I don't introduce overhead [wink]

Share this post


Link to post
Share on other sites
Hi

As WitchLord said, probably is needed to call prepare() each time ,i dont have confirmed this, but i use a modified version where i call prepare at the script compilation, and call execute() each frame, without calling prepare, avoiding the overhead
The scripts use the last stack state for each new frame, with script/context pairs

I dont know what is the current implementation state of the ASM VM, but a few changes are needed, like updating the eip at the execution ret

Lioric



Share this post


Link to post
Share on other sites
That is actually a good idea. I think I will change the behaviour of Execute to reset the status when it is finished. That way the application would be allowed to call Execute() again without first calling Prepare() if the same script function is to be called.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement