<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Correcting Logical Fallacies: Why Java Is Not Slow</title>
	<atom:link href="http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/feed/" rel="self" type="application/rss+xml" />
	<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/</link>
	<description>devnulled provides news, tips, resources, and articles about various topics that software developers and engineers enjoy.</description>
	<pubDate>Sun, 23 Nov 2008 14:33:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>By: Jordan</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-484812</link>
		<dc:creator>Jordan</dc:creator>
		<pubDate>Thu, 22 May 2008 20:06:59 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-484812</guid>
		<description>Abubakar: You can't write the JVM in Java, because you can't run it without having a JVM. To write the JVM in Java, you'd have to run another JVM to house your first JVM. But then you get infinite recursion, which would actually hamper your performance.

I did a recent benchmark myself just as a quick test (I'll post it myself eventually), between Java and C++. The benchmark in question was "calculate all the prime numbers between 2 and n using the seive-primes method". 

Seive-prime method: Have a boolean array of size n, with all elements true. Starting at i=2, for each entry, if the array is true, set all multiples of i to be false and output i, which is prime. This will list all the primes in that range.

The machine in question was running Ubuntu-8.04 on a T5400 CPU with 2GB of RAM. I used System.nanotime() in Java and the time command in C++ to arrive at the final times. Java was run with jre-1.6.0.6 from Sun, while C++ was compiled with g++ -O3 (-O3 = optimize as much as possible). The code between the two languages is near-identical, save that I actually had the option for file I/O in Java, and of course { inline, public static vs. outside-of-class functions }; I have yet to add const/final keywords, but will do that sooner or later.

The conclusion is this: Java and C++ performed exactly the same. With n set to 100000000 (that's 100 million), both took about nine seconds. The difference was on the order of milliseconds. Interestingly, even when writing to a file, Java took nearly the same amount of time (an extra couple hundred milliseconds), despite producing a 50MB(!) file.</description>
		<content:encoded><![CDATA[<p>Abubakar: You can&#8217;t write the JVM in Java, because you can&#8217;t run it without having a JVM. To write the JVM in Java, you&#8217;d have to run another JVM to house your first JVM. But then you get infinite recursion, which would actually hamper your performance.</p>
<p>I did a recent benchmark myself just as a quick test (I&#8217;ll post it myself eventually), between Java and C++. The benchmark in question was &#8220;calculate all the prime numbers between 2 and n using the seive-primes method&#8221;. </p>
<p>Seive-prime method: Have a boolean array of size n, with all elements true. Starting at i=2, for each entry, if the array is true, set all multiples of i to be false and output i, which is prime. This will list all the primes in that range.</p>
<p>The machine in question was running Ubuntu-8.04 on a T5400 CPU with 2GB of RAM. I used System.nanotime() in Java and the time command in C++ to arrive at the final times. Java was run with jre-1.6.0.6 from Sun, while C++ was compiled with g++ -O3 (-O3 = optimize as much as possible). The code between the two languages is near-identical, save that I actually had the option for file I/O in Java, and of course { inline, public static vs. outside-of-class functions }; I have yet to add const/final keywords, but will do that sooner or later.</p>
<p>The conclusion is this: Java and C++ performed exactly the same. With n set to 100000000 (that&#8217;s 100 million), both took about nine seconds. The difference was on the order of milliseconds. Interestingly, even when writing to a file, Java took nearly the same amount of time (an extra couple hundred milliseconds), despite producing a 50MB(!) file.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-440697</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Sun, 13 Apr 2008 02:36:18 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-440697</guid>
		<description>Re: Comment by Abubakar — September 27, 2007 @ 8:35 pm
Sorry I know this is closed, but I don't understand how you could possibly write a JVM in a language that needs a JVM... Seems like 'turtles all the way down' argument...</description>
		<content:encoded><![CDATA[<p>Re: Comment by Abubakar — September 27, 2007 @ 8:35 pm<br />
Sorry I know this is closed, but I don&#8217;t understand how you could possibly write a JVM in a language that needs a JVM&#8230; Seems like &#8216;turtles all the way down&#8217; argument&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-300211</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Fri, 16 Nov 2007 12:18:23 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-300211</guid>
		<description>Java is slow!. I am 100% sure of that. Even if you optimize every possible way , it will be slower than c or c++. Also it is easy to make java slow than c++. Bad coding and bad architecure is the problem. Java will never close to c++ in fast response initially but can pick it up once it is in memory. So initial user experience is the one that counts. Java is slow. Period. 
Every webpage with .jsp extension is slow compared same "concept" asp.  So there is also problem in the way server side technology implementation.  You need extremely sun fast servers to make jsp file to respond faster. That said t, growth of Java makes microsoft work harder, otherwise they will be continue to give us buggy technologies. I think WPF concept from microsoft will be very successful.</description>
		<content:encoded><![CDATA[<p>Java is slow!. I am 100% sure of that. Even if you optimize every possible way , it will be slower than c or c++. Also it is easy to make java slow than c++. Bad coding and bad architecure is the problem. Java will never close to c++ in fast response initially but can pick it up once it is in memory. So initial user experience is the one that counts. Java is slow. Period.<br />
Every webpage with .jsp extension is slow compared same &#8220;concept&#8221; asp.  So there is also problem in the way server side technology implementation.  You need extremely sun fast servers to make jsp file to respond faster. That said t, growth of Java makes microsoft work harder, otherwise they will be continue to give us buggy technologies. I think WPF concept from microsoft will be very successful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abubakar</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-241011</link>
		<dc:creator>Abubakar</dc:creator>
		<pubDate>Fri, 28 Sep 2007 03:35:36 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-241011</guid>
		<description>I dont agree. Look at JVM, it is itself written in c/c++. Can we ask why not was it written in Java? If you wrote it in java, wouldnt it be faster to develop and have less bugs too (and less testing time)? Well its just that its not *fast* enough for this job! JVM is a very very critical application. No matter what language produces the byte code, its the JVM that gives you the end performance impressions and which can not be compromised, SO: write it in C++. Now I dont see Java speed getting *better* with time, what I see is that the *processors* are getting faster. Now v have quade cores available. You run the same app of java on a multi core proc machine and it'll run faster and in the next few years java ppl are going to be saying "oh look we have become so fast" and "lets write the JVM in java too!". And u'll simply have a jvm in java *not* because java would have become faster, but because machines will be able to run the code faster. And at that time even, c++ will blow the pants off java if you'll dare compare it again :)

cheers ...</description>
		<content:encoded><![CDATA[<p>I dont agree. Look at JVM, it is itself written in c/c++. Can we ask why not was it written in Java? If you wrote it in java, wouldnt it be faster to develop and have less bugs too (and less testing time)? Well its just that its not *fast* enough for this job! JVM is a very very critical application. No matter what language produces the byte code, its the JVM that gives you the end performance impressions and which can not be compromised, SO: write it in C++. Now I dont see Java speed getting *better* with time, what I see is that the *processors* are getting faster. Now v have quade cores available. You run the same app of java on a multi core proc machine and it&#8217;ll run faster and in the next few years java ppl are going to be saying &#8220;oh look we have become so fast&#8221; and &#8220;lets write the JVM in java too!&#8221;. And u&#8217;ll simply have a jvm in java *not* because java would have become faster, but because machines will be able to run the code faster. And at that time even, c++ will blow the pants off java if you&#8217;ll dare compare it again <img src='http://devnulled.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>cheers &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: owen</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-237649</link>
		<dc:creator>owen</dc:creator>
		<pubDate>Tue, 25 Sep 2007 14:36:06 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-237649</guid>
		<description>I see what you saying but the JVM cannot replace a good programmer and it can't make a bad program better or faster or more optimize.  Even saying that it can ever be faster than C++ is like saying that it can be faster than assembly.  The problem with java is that there is just too much going on in the background too much "magic".  in todays "what you see is what you get" world if it looks slow people are going to say its slow.  Who wants to wait 2 hrs for the JVM to optimize itself?

Its better to stop comparing it C++ and look for more comparable cross platform languages.</description>
		<content:encoded><![CDATA[<p>I see what you saying but the JVM cannot replace a good programmer and it can&#8217;t make a bad program better or faster or more optimize.  Even saying that it can ever be faster than C++ is like saying that it can be faster than assembly.  The problem with java is that there is just too much going on in the background too much &#8220;magic&#8221;.  in todays &#8220;what you see is what you get&#8221; world if it looks slow people are going to say its slow.  Who wants to wait 2 hrs for the JVM to optimize itself?</p>
<p>Its better to stop comparing it C++ and look for more comparable cross platform languages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: amara</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-151204</link>
		<dc:creator>amara</dc:creator>
		<pubDate>Sun, 08 Jul 2007 21:03:18 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-151204</guid>
		<description>While I have little experience in Java programming, as C/C++ and C# are my main languages of choice, I have done some Java programming before. Being a user and a java programmer (albeit nothing serious) I can see how people can get the impression that its slow. Java apps have been, in past experiences, a little sluggish compared to C++ applications. They just don't respond as quickly and feel lethargic to use.

IMO, I think .NET has the upper hand over Java and its class framework. We're seeing more and more .NET based websites using asp.net, c#, vb.net etc which are very fast because of the CLR and JIT.</description>
		<content:encoded><![CDATA[<p>While I have little experience in Java programming, as C/C++ and C# are my main languages of choice, I have done some Java programming before. Being a user and a java programmer (albeit nothing serious) I can see how people can get the impression that its slow. Java apps have been, in past experiences, a little sluggish compared to C++ applications. They just don&#8217;t respond as quickly and feel lethargic to use.</p>
<p>IMO, I think .NET has the upper hand over Java and its class framework. We&#8217;re seeing more and more .NET based websites using asp.net, c#, vb.net etc which are very fast because of the CLR and JIT.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan S</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-146681</link>
		<dc:creator>Dan S</dc:creator>
		<pubDate>Tue, 03 Jul 2007 17:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-146681</guid>
		<description>What matters most is the bottom line, which is the "user experience." From the user perspective, Java is slow or sluggish or anything but impressive and quick. That's what matters in the end. The day Java applications seem quick is the day it can be argued that Java is not slow.</description>
		<content:encoded><![CDATA[<p>What matters most is the bottom line, which is the &#8220;user experience.&#8221; From the user perspective, Java is slow or sluggish or anything but impressive and quick. That&#8217;s what matters in the end. The day Java applications seem quick is the day it can be argued that Java is not slow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: diet pepsy</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-141326</link>
		<dc:creator>diet pepsy</dc:creator>
		<pubDate>Wed, 27 Jun 2007 18:42:03 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-141326</guid>
		<description>Not to mess up your good time, but there are reasons why Java can not be faster than C++ in many ways:

- All objects in Java are allocated on the heap; in C++ you can choose to allocate them on the heap, stack; for very fast ops, even register allocation class is used
- All functions are virtual which means at least an indirection to a table of function pointers.
- It is very hard for a compiler to automatically optimize to the level that a good developer can optimize (inline functions, placing the most cost effective 'ifs' first, etc).

Granted that this doesn't matter for a JSP or a SWING application, but if you are writing server applications or some other complicated application (like a game or operating system modules, or device drivers, etc), Java is not good enough. 
Think that C++ was arround for 30 years now and there are a lot of heavy applications written in it. It will definetly evolve - it did over time - as an open standard and not something controlled by a corporation. 
And in the end, it is not really a discussion between C++ and Java - not anymore. Now, various componens of an application can be written in the language that helps you achieve faster the desired result. For websites, some may argue is PHP :)</description>
		<content:encoded><![CDATA[<p>Not to mess up your good time, but there are reasons why Java can not be faster than C++ in many ways:</p>
<p>- All objects in Java are allocated on the heap; in C++ you can choose to allocate them on the heap, stack; for very fast ops, even register allocation class is used<br />
- All functions are virtual which means at least an indirection to a table of function pointers.<br />
- It is very hard for a compiler to automatically optimize to the level that a good developer can optimize (inline functions, placing the most cost effective &#8216;ifs&#8217; first, etc).</p>
<p>Granted that this doesn&#8217;t matter for a JSP or a SWING application, but if you are writing server applications or some other complicated application (like a game or operating system modules, or device drivers, etc), Java is not good enough.<br />
Think that C++ was arround for 30 years now and there are a lot of heavy applications written in it. It will definetly evolve - it did over time - as an open standard and not something controlled by a corporation.<br />
And in the end, it is not really a discussion between C++ and Java - not anymore. Now, various componens of an application can be written in the language that helps you achieve faster the desired result. For websites, some may argue is PHP <img src='http://devnulled.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Absolutely No Machete Juggling &#187; Blog Archive &#187; Java Security FUD</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-67210</link>
		<dc:creator>Absolutely No Machete Juggling &#187; Blog Archive &#187; Java Security FUD</dc:creator>
		<pubDate>Wed, 28 Feb 2007 00:22:12 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-67210</guid>
		<description>[...] As soon as Java started to grow in popularity, the misinformation about it began to spread. There are, of course, a number of legitimate criticisms of Java, but most of them have been used constructively to improve it. One of the oldest criticisms of Java was that it is slow - a criticism that was valid once-upon-a-time, but has become decreasingly relevant as Sun has made improvements to the JVM (particularly with Just-In-Time compilation). My friend Brandon has thoroughly deflated this criticism in a blog post that grew into a JDJ article (congrats, Brandon!), so I won&#8217;t spend any more time on it. [...]</description>
		<content:encoded><![CDATA[<p>[...] As soon as Java started to grow in popularity, the misinformation about it began to spread. There are, of course, a number of legitimate criticisms of Java, but most of them have been used constructively to improve it. One of the oldest criticisms of Java was that it is slow - a criticism that was valid once-upon-a-time, but has become decreasingly relevant as Sun has made improvements to the JVM (particularly with Just-In-Time compilation). My friend Brandon has thoroughly deflated this criticism in a blog post that grew into a JDJ article (congrats, Brandon!), so I won&#8217;t spend any more time on it. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean LeBlanc</title>
		<link>http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-64901</link>
		<dc:creator>Sean LeBlanc</dc:creator>
		<pubDate>Mon, 19 Feb 2007 02:30:51 +0000</pubDate>
		<guid isPermaLink="false">http://devnulled.com/content/2007/02/correcting-logical-fallacies-why-java-is-not-slow/#comment-64901</guid>
		<description>Good post, Brandon. Unfortunately, facts rarely get in the way of a good myth. 

I read a while ago (might have been a few years ago) that one possible source of this perception is poorly-written apps, especially Swing apps, using threading poorly or not at all.

Unfortunately, I think this myth is going to be a hard one to put to bed...look at Paul Graham - he's been fighting the "Lisp is for AI" myth for a while, and that hasn't exactly been put to bed, either.</description>
		<content:encoded><![CDATA[<p>Good post, Brandon. Unfortunately, facts rarely get in the way of a good myth. </p>
<p>I read a while ago (might have been a few years ago) that one possible source of this perception is poorly-written apps, especially Swing apps, using threading poorly or not at all.</p>
<p>Unfortunately, I think this myth is going to be a hard one to put to bed&#8230;look at Paul Graham - he&#8217;s been fighting the &#8220;Lisp is for AI&#8221; myth for a while, and that hasn&#8217;t exactly been put to bed, either.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
