News for hackers. Stuff that matters.
Re:Mono's New .NET Interpreter by alkonaut on Monday November 13, 2017 @04:17PM (#15690340)
> Because you aren't using Roslyn to execute anything. You're using it to compile C# to CIL. That CIL is then executed by a different part of the system - the JIT.

Right - with Roslyn Run("somecode") means creating an assembly from the code, then loading it into the current AppContext and executing it there. If I were to run an interpreter then Run ("someCode") is interpreted. I get that.

My question was still only: would an application chose one or the other, when given both options. I get that they are completely separate ideas and Roslyn doesn't do anything an interpreter does (Roslyn and jit does) - but "compile+load" and "interpret" both offer a way to solve the Run("somecode") problem, which is why they are still somewhat related in the specific context of a .NET app with scripting

Re:Mono's New .NET Interpreter by lewurm on Monday November 13, 2017 @05:24PM (#15690859)
Ideally, an application doesn't have to choose, but the runtime uses some good defaults. For example, let's have a look at the HotSpot JVM: A Java method first gets executed in the interpreter, then, if it's hot enough it will compile the method with the C1 JIT, and then later uses the C2 JIT to bring the method up to full peak performance. There is also some profiling going on that is fed into the JITs to guide optimizations. The transition between the execution tiers is based on some heuristics and is kinda complex.

Do you need to care as an application? Ideally no :-) It should be transparent to the user and it's the runtime's job to do the best available thing for you. (Sure, the runtime can be tweaked for specific workloads etc.)

In Mono we aren't there yet: the interpreter is currently useful for restricted targets like iOS, where a JIT can't be used due to security concerns and AOT comes with certain limitations (that is, loading assemblies at runtime and execute them). If you want to use Mono's Interpreter to run roslyn, you can explicitly tell the runtime to do so, but it doesn't make much sense today, because it will give you less performance than the available JIT; we don't support switching the execution engine on the fly for single methods yet (it's also called tiered compilation).