2 ms·
Historically, Java has better JIT compilers. One of the reasons is that Java started as a bytecode interpreter, and JIT was later bolted on for hot paths - this
by int_19h 8y ago
Historically, Java has better JIT compilers. One of the reasons is that Java started as a bytecode interpreter, and JIT was later bolted on for hot paths - this makes it possible to have JIT run for longer (since you can interpret bytecode in the meantime). .NET was JIT-only from the get go though, and its JIT compiler has to be "fast enough" that cold calls aren't atrociously slow, which restricts optimizations.
On the other hand, C# has features like structs, non-virtual methods (by default at that), and reified generics, that make for faster code without any JIT magic.
And, depending on the exact code being tested, one or the other factor can easily dominate.