Lately I was trying to understand
how virtual memory works
and how JVM work and perform.
My intuition was ' if a JVM is written in C, it is probably less performant than C '
So after a lot of reading and investigations I found out that the story is much more complicated then I have initially thought.
JVM has many optimization which makes it very fast most of the time, it does has an overhead but the optimization in JIT make everything worth it.
basically the JVM will loaded into native virtual memory (and be shared with other processes when possible)
it will use sophisticated algorithms to allocate memory on the native heap to create managed heap.
it will JIT to perform well, will vectorise actions and what not to make the run time overhead worth it.
The V8 engine is highly optimized and make all kind of clever things to perform faster, for example making a behind the scene classes and types and caches to speed up the execution.
Any way I thought that I have to make my own test to better understand the performance difference in various situations, so here it is, my results
java and node win when performing loops and in memory
c and go win as of for reading file from disk to memory
java wins in http server
hope you will find this info helpful!
Comments are more the welcome.
I also have a blog with other interesting stuff: