<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 2bitornot2bit - Ben Amsallem</title>
    <description>The latest articles on DEV Community by 2bitornot2bit - Ben Amsallem (@benchuknii).</description>
    <link>https://dev.to/benchuknii</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F138462%2Fc4e4051b-6d03-4f2f-9543-dc48b938d904.jpg</url>
      <title>DEV Community: 2bitornot2bit - Ben Amsallem</title>
      <link>https://dev.to/benchuknii</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/benchuknii"/>
    <language>en</language>
    <item>
      <title>PERFORMANCE OF JVM VS NATIVE VS THE WORLD</title>
      <dc:creator>2bitornot2bit - Ben Amsallem</dc:creator>
      <pubDate>Wed, 20 Feb 2019 10:32:57 +0000</pubDate>
      <link>https://dev.to/benchuknii/performance-of-jvm-vs-native-vs-the-world-3mie</link>
      <guid>https://dev.to/benchuknii/performance-of-jvm-vs-native-vs-the-world-3mie</guid>
      <description>&lt;p&gt;Lately I was trying to understand &lt;br&gt;
&lt;a href="https://manybutfinite.com/post/how-the-kernel-manages-your-memory/"&gt;how virtual memory works&lt;/a&gt;&lt;br&gt;
 and &lt;a href="https://www.ibm.com/developerworks/library/j-nativememory-linux/"&gt;how JVM work and perform&lt;/a&gt;.&lt;br&gt;
My intuition was ' if a JVM is written in C, it is probably less performant than C '&lt;br&gt;
So after a lot of reading and investigations I found out that the story is much more complicated then I have initially thought.&lt;br&gt;
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.&lt;br&gt;
basically the JVM will loaded into native virtual memory (and be shared with other processes when possible)&lt;br&gt;
it will use sophisticated algorithms to allocate memory on the native heap to create managed heap.&lt;br&gt;
it will JIT to perform well, will vectorise  actions and what not to make the run time overhead worth it.&lt;br&gt;
At that point I was thinking ' OK, so javascript is a VM, it should probably also perform well '&lt;br&gt;
But &lt;a href="https://www.techempower.com/benchmarks/#section=test&amp;amp;runid=8ca46892-e46c-4088-9443-05722ad6f7fb&amp;amp;hw=ph&amp;amp;test=plaintext"&gt;benchmark tests online showed different things&lt;/a&gt;. I know javascript is single threaded but this tests take this into account (For example fork many process).&lt;br&gt;
The V8 engine is highly optimized and &lt;a href="https://blog.sessionstack.com/how-javascript-works-inside-the-v8-engine-5-tips-on-how-to-write-optimized-code-ac089e62b12e"&gt;make all kind of clever things&lt;/a&gt; to perform faster, for example making a behind the scene classes and types and caches to speed up the execution.&lt;br&gt;
V8 is still young compared to C and Java so I am sure it will be even better. my impression is that optimizing a dynamic language such as javascript is harder than a language like java, but I might be wrong here.&lt;/p&gt;

&lt;p&gt;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, &lt;a href="https://github.com/benchuk/performance_tests"&gt;my results&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;​java and node win when performing loops and in memory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;c and go win as of for reading file from disk to memory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;java wins in http server&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;hope you will find this info helpful!&lt;/p&gt;

&lt;p&gt;Comments are more the welcome.&lt;/p&gt;

&lt;p&gt;I also have a blog with other interesting stuff:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.2bitornot2bit.com/blog"&gt;https://www.2bitornot2bit.com/blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>node</category>
      <category>go</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
