Say if my code is always going to be run on a particular processor and if I have this information during installation - is there a chance I can avoid JIT?
NGEN is the obvious answer, but I would point out that JIT-ed code can be faster as it "knows" about things at runtime that NGEN can't. We use that fact to literally drop lines of code on the floor at runtime based on a setting in our .config files:
static readonly bool _EnableLogging = LoadFromConfigFile("EnableLogging");
if (_EnableLogging && log.IsDebugEnabled)
{
//Do some logging
}
In this example NGEN must leave the if statement in the code because it has no idea what the value of the _EnableLogging field is. However, JIT does know the value for this run and if it's false then there's no way the if statement will ever be processed, and the JIT will literally omit the entire if statement from the machine code it generates, resulting in a smaller codebase and therefore a faster codebase.