Jump to content

Js Jit Startup Overhead


Recommended Posts

As I'm testing the pathing stuff over and over and over and over I have noticed that it takes 10-15 seconds for the performance to settle down after a game starts. This is to be expected with the JIT since it compiles things as they get invoked.

I was wondering if we could get the JIT to compile things while we are on the game setup screen while we are sitting idle waiting on user input? We could invoke the JS code with some data that would get the JIT to compile most of the code.

I am probably doing a bad or worst case scenario as I select a group of units and start trying to move them around immediately. This causes a lot of JS activity (formations and stuff) in addition to all the AI startup stuff thats going on at the same time (UnitAI and Computer AI startup). This isn't a high priority, but it does make the game really sluggish at the start so it's something we should think about.

Link to comment
Share on other sites

As far as I'm aware, the JIT shouldn't have that much effect - the tracing JIT kicks in after a loop has done about 15 iterations, and the method JIT "should be triggering in order of microseconds" (according to Mozilla people). (JS engines are designed for web pages, so they need to be fast pretty quickly - there's no point waiting several seconds before activating the JIT since the page will have finished loading by then). The simulation scripts are fast enough that enabling/disabling the JIT didn't (when I tested it) have any significant effect on it anyway - it only matters for RMS and (sometimes) player-AI scripts.

I think it's far more likely that something else is causing any noticeable slowdowns: maybe the on-demand loading of meshes/animations/etc, or maybe the player-AI scripts choosing to do a load of computation (if you have any AI players loaded), or something along those lines. Might be useful to get profiler measurements during the slow and not-slow periods and compare them to see what it points at.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...