Sign in to follow this  
Holy Fuzz

[.net] JIT Compiler

Recommended Posts

Holy Fuzz    213
Is there is any way for my program to tell the .Net JIT to finish compiling the entire app? I know that the JIT compiles a function when the function is first called, but this can cause a slightly noticable delay on old computers when suddenly a lot of new code is executed (certain actions that do not load any resources but still produce a small delay when they are first performed). What I'd like to do is get all of the compiling done on the initial lode, so that these slight delays do not happen. Any way to do this? Thanks. - Fuzz

Share this post


Link to post
Share on other sites
Lenolian    140
Note that using NGen will not speed up your app, in most case it will slow it down. JIT makes a lot of optimizations, by using Ngen you loose most of them.

Share this post


Link to post
Share on other sites
Holy Fuzz    213
Thanks for the info.

It is my understanding after reading the articles Promit linked that NGen is run on the client computer (say during installation) and invokes the JIT, which performs all optimizations for that computer's architecture. Is this understanding correct?

The problem with NGen is that it's a little inconvenient. Either the user would have to run it on my program or the installer would (which isn't a big deal, but I'd have to figure out how to do it).

So there isn't any API or anything that I can call which tells the JIT to finish compiling?

Thanks!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
There are tons of information why you shouldn't do what you're asking for, and why you shouldn't use NGen. Solve your problems in another way. What exact code paths are causing the problem? Make sure to call that code during startup instead to avoid that problems.

Share this post


Link to post
Share on other sites
Holy Fuzz    213
On low-end machines, there is a small (< second) delay when the first order is given to a unit, which executes code such as pathfinding, AI, logic, etc... After that, no delay at all. Calling this code during startup sounds like a hack, not to mention impossible or at least extremely impracticle.

Share this post


Link to post
Share on other sites
PyroSA    122
It's much less of a hack than using something like NGen. You could easily do some of these calls, by making the first unit you create move to the block he is currently standing in, or some similar 'dummy' move. You should be able to call this 'hack' right after your loading, just before your game loop begins.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this