Jump to content
Leopard20

Code Optimization: onEachFrame vs WaitUntil vs Draw3D

Recommended Posts

15 hours ago, Leopard20 said:

which one of the three methods mentioned is best for an on each frame code?

 

I wouldn't use waitUntil because no matter how light weight code you put in there it maybe that rest of your scripts steal all the processing time making the waitUntil not run on every frame. So I'd say it's either onEachFrame or Draw3D and I would go with onEachFrame unless there's need to draw something or do something otherwise graphical.

Share this post


Link to post
Share on other sites

What is it you are using EachFrame for exactly? Just wondering. What code?

Share this post


Link to post
Share on other sites
4 hours ago, gc8 said:

 

I wouldn't use waitUntil because no matter how light weight code you put in there it maybe that rest of your scripts steal all the processing time making the waitUntil not run on every frame. So I'd say it's either onEachFrame or Draw3D and I would go with onEachFrame unless there's need to draw something or do something otherwise graphical.

I don't know. If you don't put sleep in there it works fine enough! 😉 But thanks for the advice.

 

4 hours ago, HazJ said:

What is it you are using EachFrame for exactly? Just wondering. What code?

Me? I posted the code and the reason in a few comments back!

Share this post


Link to post
Share on other sites
On 2/21/2019 at 7:52 PM, Leopard20 said:

So to recap, which one of the three methods mentioned is best for an on each frame code? (in this case, mine, which I have now fully posted!)

Well, the waitUntil we can already throw out because it's not each frame.

Already told you, you shouldn't be using Draw3D if you are not drawing, so that's also out. So there's only one left.

you forgot the addMissionEH EachFrame though, but comparing that to the BIS function is not that easy.
The BIS function evaluates the eventhandlers in script, meaning it adds a small script overhead to each execution.
The engine one (the command) doesn't do that, however it recompiles the code before every execution. Hard to figure out which one has less overhead.

  • Like 2

Share this post


Link to post
Share on other sites
6 hours ago, Dedmen said:

The engine one (the command) doesn't do that, however it recompiles the code before every execution.

Does it also have the memory leak bug that you posted on the issue tracker? If so, it's out too IMO!

Share this post


Link to post
Share on other sites
14 hours ago, Leopard20 said:

Does it also have the memory leak bug that you posted on the issue tracker? If so, it's out too IMO!

Yeah. That's the only bonus I see from the scripted eventhandler. No leak.

But the leak will be fixed in next Arma update anyway so who cares?

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×