tagged [jit]

IL optimization for JIT compilers

IL optimization for JIT compilers I am developing a compiler that emits IL code. It is important that the resulting IL is JIT'ted to the fastest possible machine codes by Mono and Microsoft .NET JIT c...

20 Jun at 19:41

Can the C# compiler or JIT optimize away a method call in a lambda expression?

Can the C# compiler or JIT optimize away a method call in a lambda expression? I'm starting this question after a discussion which started ([in comments](https://stackoverflow.com/a/36438566/81179)) o...

Why shouldn't I use PyPy over CPython if PyPy is 6.3 times faster?

Why shouldn't I use PyPy over CPython if PyPy is 6.3 times faster? I've been hearing a lot about the [PyPy](http://en.wikipedia.org/wiki/PyPy) project. They claim it is 6.3 times faster than the [CPyt...

30 Sep at 20:14

.NET local variable optimization

.NET local variable optimization I was reading through the .NET sources when I found this: ``` // Constructs a Decimal from an integer value. // public Decimal(int value) { // JIT today can't inline...

14 Oct at 20:1

What kind of optimizations do both the C# compiler and the JIT do?

What kind of optimizations do both the C# compiler and the JIT do? I'm continuing my work on my C# compiler for my Compilers Class. At the moment I'm nearly finished with the chapters on Compiler Opti...

Is IL generated by expression trees optimized?

Is IL generated by expression trees optimized? Ok this is merely curiosity, serves no real world help. I know that with expression trees you can generate MSIL on the fly just like the regular C# compi...

Does setting the platform when compiling a c# application make any difference?

Does setting the platform when compiling a c# application make any difference? In VS2012 (and previous versions...), you can specify the target platform when building a project. My understanding, thou...

Potential .NET x86 JIT issue?

Potential .NET x86 JIT issue? The following code behaves differently when built in Release mode (or Debug with optimizations on) and run the Visual Studio debugger attached. It also only seems to repl...

11 Jul at 22:17

Does the .NET garbage collector perform predictive analysis of code?

Does the .NET garbage collector perform predictive analysis of code? OK, I realize that question might seem weird, but I just noticed something that really puzzled me... Have a look at this code : ```...

1 Jul at 19:41

Why is 2 * (i * i) faster than 2 * i * i in Java?

Why is 2 * (i * i) faster than 2 * i * i in Java? The following Java program takes on average between 0.50 secs and 0.55 secs to run: ``` public static void main(String[] args) { long startTime = Sy...

Do redundant casts get optimized?

Do redundant casts get optimized? I am updating some old code, and have found several instances where the same object is being cast repeatedly each time one of its properties or methods needs to be ca...

Preventing JIT inlining on a method

Preventing JIT inlining on a method I've got sort of a unique situation. I've been working on an open source library for sending email. In this library, I need a reliable way to get the calling method...

2 Mar at 14:58

.NET 3.5 JIT not working when running the application

.NET 3.5 JIT not working when running the application The following code gives different output when running the release inside Visual Studio, and running the release outside Visual Studio. I'm using ...

9 Jan at 09:22

Task<T> async causing Xamarin.iPhone (MonoTouch) JIT error?

Task async causing Xamarin.iPhone (MonoTouch) JIT error? I use the ServiceStack dll’s quite a bit but they had not exposed appropriate async methods so I went ahead and made these myself. Please can s...

EntityFramework.Extended Future error (JIT Compiler internal limitation)

EntityFramework.Extended Future error (JIT Compiler internal limitation) I am working with Code First EntityFramework (`version="6.1.0"`) and EntityFramework.Extended (version="6.1.0.96, the latest bu...

RyuJit producing incorrect results

RyuJit producing incorrect results After recently upgrading to .net 4.6 we discovered a bug where RyuJit produces incorrect results, we were able to work around the issue for now by adding useLegacyJi...

22 Jul at 17:53

Is there a way to get the .Net JIT or C# compiler to optimize away empty for-loops?

Is there a way to get the .Net JIT or C# compiler to optimize away empty for-loops? A followup to [Does .NET JIT optimize empty loops away?](https://stackoverflow.com/questions/539047/does-net-jit-opt...

23 May at 12:7

Why is it slower to compare a nullable value type to null on a generic method with no constraints?

Why is it slower to compare a nullable value type to null on a generic method with no constraints? I came across a very funny situation where comparing a nullable type to null inside a generic method ...

I've found a bug in the JIT/CLR - now how do I debug or reproduce it?

I've found a bug in the JIT/CLR - now how do I debug or reproduce it? I have a computationally-expensive multi-threaded C# app that seems to crash consistently after 30-90 minutes of running. The erro...

20 Jun at 09:12

How is .NET JIT compilation performance (including dynamic methods) affected by image debug options of C# compiler?

How is .NET JIT compilation performance (including dynamic methods) affected by image debug options of C# compiler? I am trying to optimize my application for for it to perform well right after it is ...

7 May at 05:48

JIT .Net compiler bug?

JIT .Net compiler bug? The result of the following Code differs If it is started with the debugger in the background or without. The difference is only there, if optimization is switched on. This is t...

17 Jan at 19:59

Properties slower than fields

Properties slower than fields It seems that every post I have come across comes to the same consensus: properties that merely return a field are inlined by JIT and have nearly identical performance to...

14 Dec at 19:14

How do I write (test) code that will not be optimized by the compiler/JIT?

How do I write (test) code that will not be optimized by the compiler/JIT? I don't really know much about the internals of compiler and JIT optimizations, but I usually try to use "common sense" to gu...

21 May at 19:19

Layout of .NET value type in memory

Layout of .NET value type in memory I have the following .NET value types: I have code that is passing a pointer to a value type to un

4 Apr at 13:33

Forcing the .NET JIT compiler to generate the most optimized code during application start-up

Forcing the .NET JIT compiler to generate the most optimized code during application start-up I'm writing a DSP application in C# (basically a multitrack editor). I've been profiling it for quite some...