<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How well do you know Java?</title>
	<atom:link href="http://labnotes.org/2007/02/10/how-well-do-you-know-java/feed/" rel="self" type="application/rss+xml" />
	<link>http://labnotes.org/2007/02/10/how-well-do-you-know-java/</link>
	<description></description>
	<lastBuildDate>Sun, 15 Jan 2012 21:29:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Refresh Your Mind - Hendy Irawan</title>
		<link>http://labnotes.org/2007/02/10/how-well-do-you-know-java/comment-page-1/#comment-137605</link>
		<dc:creator>Refresh Your Mind - Hendy Irawan</dc:creator>
		<pubDate>Tue, 13 Feb 2007 02:16:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labnotes.org/2007/02/10/how-well-do-you-know-java/#comment-137605</guid>
		<description>[...] from Assaf: &#8230; every once in a while, we need to step back, forget all that we believe is true, and look [...]</description>
		<content:encoded><![CDATA[<p>[...] from Assaf: &#8230; every once in a while, we need to step back, forget all that we believe is true, and look [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: http://dvae.livejournal.com/</title>
		<link>http://labnotes.org/2007/02/10/how-well-do-you-know-java/comment-page-1/#comment-137602</link>
		<dc:creator>http://dvae.livejournal.com/</dc:creator>
		<pubDate>Mon, 12 Feb 2007 13:00:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labnotes.org/2007/02/10/how-well-do-you-know-java/#comment-137602</guid>
		<description>If you use a more recent version of java, then it&#039;s start up is faster than ruby.

At least that is what Charles Nutter found with these numbers:

$ time java -cp lib/jruby.jar:lib/asm-2.2.2.jar:. fib_recursive
5702887
real    0m8.126s
user    0m7.632s
sys     0m0.208s

$ time ruby fib_recursive.rb
5702887
real    0m14.649s
user    0m12.945s
sys     0m1.480s

Full (long) blog post on jruby JIT: http://headius.blogspot.com/2007/01/jruby-compiler-in-trunk-and-ready-to.html</description>
		<content:encoded><![CDATA[<p>If you use a more recent version of java, then it&#8217;s start up is faster than ruby.</p>
<p>At least that is what Charles Nutter found with these numbers:</p>
<p>$ time java -cp lib/jruby.jar:lib/asm-2.2.2.jar:. fib_recursive<br />
5702887<br />
real    0m8.126s<br />
user    0m7.632s<br />
sys     0m0.208s</p>
<p>$ time ruby fib_recursive.rb<br />
5702887<br />
real    0m14.649s<br />
user    0m12.945s<br />
sys     0m1.480s</p>
<p>Full (long) blog post on jruby JIT: <a href="http://headius.blogspot.com/2007/01/jruby-compiler-in-trunk-and-ready-to.html" rel="nofollow">http://headius.blogspot.com/2007/01/jruby-compiler-in-trunk-and-ready-to.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assaf</title>
		<link>http://labnotes.org/2007/02/10/how-well-do-you-know-java/comment-page-1/#comment-137599</link>
		<dc:creator>Assaf</dc:creator>
		<pubDate>Sun, 11 Feb 2007 12:49:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labnotes.org/2007/02/10/how-well-do-you-know-java/#comment-137599</guid>
		<description>Apotheon,

The narrow focus on only measuring performance in the app server is the problem. Let&#039;s drop desktop apps and Applets, because Java is not even a contender there.

Java&#039;s worst enemy is not Ruby or Perl or C#; Java&#039;s worst enemy is Java.

If I can write a simple task in Ruby in five minutes, that will take 10 seconds to execute. And I can write the same task in Java in two hours, that will take 5 seconds to execute. Which one is faster?

There&#039;s the holisitic view to measuring performance. And then there&#039;s the beauty contest view to measuring performance, where you only show the flattering profile.

Now, someone may say apples vs oranges. But that&#039;s real life. Software is about automating things, at least the kind of software I write about, and what you gain from automation comes after the cost it takes to create it.

If some tool allows me to automate more things, cheaper and better, I&#039;d use it. 

The beauty contest approach to measuring performance made Java incredibly fast in a very narrow context, but incredibly slow in so many other tasks a language should perform.

I don&#039;t think people would even bother to respond to my post if Java wasn&#039;t, right now, on the defensive from other languages that are eating its lunch, percisely because it optimized the wrong thing.</description>
		<content:encoded><![CDATA[<p>Apotheon,</p>
<p>The narrow focus on only measuring performance in the app server is the problem. Let&#8217;s drop desktop apps and Applets, because Java is not even a contender there.</p>
<p>Java&#8217;s worst enemy is not Ruby or Perl or C#; Java&#8217;s worst enemy is Java.</p>
<p>If I can write a simple task in Ruby in five minutes, that will take 10 seconds to execute. And I can write the same task in Java in two hours, that will take 5 seconds to execute. Which one is faster?</p>
<p>There&#8217;s the holisitic view to measuring performance. And then there&#8217;s the beauty contest view to measuring performance, where you only show the flattering profile.</p>
<p>Now, someone may say apples vs oranges. But that&#8217;s real life. Software is about automating things, at least the kind of software I write about, and what you gain from automation comes after the cost it takes to create it.</p>
<p>If some tool allows me to automate more things, cheaper and better, I&#8217;d use it. </p>
<p>The beauty contest approach to measuring performance made Java incredibly fast in a very narrow context, but incredibly slow in so many other tasks a language should perform.</p>
<p>I don&#8217;t think people would even bother to respond to my post if Java wasn&#8217;t, right now, on the defensive from other languages that are eating its lunch, percisely because it optimized the wrong thing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: apotheon</title>
		<link>http://labnotes.org/2007/02/10/how-well-do-you-know-java/comment-page-1/#comment-137598</link>
		<dc:creator>apotheon</dc:creator>
		<pubDate>Sun, 11 Feb 2007 10:03:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labnotes.org/2007/02/10/how-well-do-you-know-java/#comment-137598</guid>
		<description>The actual VM startup time isn&#039;t the only thing at issue here, though.  Java suffers (or benefits, if you&#039;re a Java-head) from a number of phenomena in the way it&#039;s implemented that significantly affect performance over the lifetime of a process.  The startup time of the VM is one factor: the optimizing capabilities of the VM are another.  Finally, there&#039;s the persistence of the VM environment.

This adds up to a big (in terms of performance benchmarks) difference between short-run application performance and long-run application performance for Java.  If you think MS Office is slow when you just want to quickly edit a document and shut down again, you should try writing it in Java and try that again.  Perl actually outperforms Java in a significant number of cases for short-run benchmarks -- Perl, which actually does its parse-tree compilation (which is a more-than-single-pass compiler, by the way) at runtime!  Count the startup time of both languages in a several second computation benchmark, and Perl will probably win.  On the other hand, if you&#039;re running a server process that churns along for months at a time, and measure its performance on day three, it will rival roughly identical code in C++ for speed (though anyone claiming it matches C doesn&#039;t understand the differences between C and C++, or writes incredibly bad spaghetti C).

Not only does measuring at the beginning capture VM startup time -- it also measures unoptimized code.  Java is a bit like vehicle with a big engine and a huge flywheel: it doesn&#039;t accelerate worth a damn, but it sure does burn up road once it gets up to speed.

In general, I agree that the actual startup time of the JVM is trivial, and mostly ignorable -- and thus, might as well be measured.  Sure, it can prove significant if you&#039;re measuring something so brief that a 0.1 second startup is problematic -- or more, on an older machine (which most of us are using, believe it or not, as I know from personal experience since a JVM would start up somewhat slower on this 1600MHz AMD than on your Core Duo 2).  That&#039;s of little import when measuring actual human wait time, though, as you point out.  The real problem is the code optimization, which doesn&#039;t happen instantly.  Let it run through its paces a few dozen times, and it&#039;s much snappier.

Basically, I guess what I&#039;m saying is that it&#039;s not really that simple.  You just have to measure all the parts that are relevant to your purpose, adjusted every time your purpose changes.  Saying Ruby does some calculation faster (or slower) than Java requires context to be worth crap, simply because of the strange (as compared with other languages) way that Java works.</description>
		<content:encoded><![CDATA[<p>The actual VM startup time isn&#8217;t the only thing at issue here, though.  Java suffers (or benefits, if you&#8217;re a Java-head) from a number of phenomena in the way it&#8217;s implemented that significantly affect performance over the lifetime of a process.  The startup time of the VM is one factor: the optimizing capabilities of the VM are another.  Finally, there&#8217;s the persistence of the VM environment.</p>
<p>This adds up to a big (in terms of performance benchmarks) difference between short-run application performance and long-run application performance for Java.  If you think MS Office is slow when you just want to quickly edit a document and shut down again, you should try writing it in Java and try that again.  Perl actually outperforms Java in a significant number of cases for short-run benchmarks &#8212; Perl, which actually does its parse-tree compilation (which is a more-than-single-pass compiler, by the way) at runtime!  Count the startup time of both languages in a several second computation benchmark, and Perl will probably win.  On the other hand, if you&#8217;re running a server process that churns along for months at a time, and measure its performance on day three, it will rival roughly identical code in C++ for speed (though anyone claiming it matches C doesn&#8217;t understand the differences between C and C++, or writes incredibly bad spaghetti C).</p>
<p>Not only does measuring at the beginning capture VM startup time &#8212; it also measures unoptimized code.  Java is a bit like vehicle with a big engine and a huge flywheel: it doesn&#8217;t accelerate worth a damn, but it sure does burn up road once it gets up to speed.</p>
<p>In general, I agree that the actual startup time of the JVM is trivial, and mostly ignorable &#8212; and thus, might as well be measured.  Sure, it can prove significant if you&#8217;re measuring something so brief that a 0.1 second startup is problematic &#8212; or more, on an older machine (which most of us are using, believe it or not, as I know from personal experience since a JVM would start up somewhat slower on this 1600MHz AMD than on your Core Duo 2).  That&#8217;s of little import when measuring actual human wait time, though, as you point out.  The real problem is the code optimization, which doesn&#8217;t happen instantly.  Let it run through its paces a few dozen times, and it&#8217;s much snappier.</p>
<p>Basically, I guess what I&#8217;m saying is that it&#8217;s not really that simple.  You just have to measure all the parts that are relevant to your purpose, adjusted every time your purpose changes.  Saying Ruby does some calculation faster (or slower) than Java requires context to be worth crap, simply because of the strange (as compared with other languages) way that Java works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assaf</title>
		<link>http://labnotes.org/2007/02/10/how-well-do-you-know-java/comment-page-1/#comment-137596</link>
		<dc:creator>Assaf</dc:creator>
		<pubDate>Sun, 11 Feb 2007 07:06:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labnotes.org/2007/02/10/how-well-do-you-know-java/#comment-137596</guid>
		<description>cyu,

Ruby is not immune from measuring the wrong thing, and I think there&#039;s enough material for future posts on that.

But Java has a particular obsession, a doctrine for only measuring that which was JITted, probably dating back to when Java was fighting the performance war against C++. Right now, for most applications, it&#039;s fast enough that we can start worrying about other things.

Some people don&#039;t think the &quot;waiting for the JIT&quot; doctrine is a problem. But hopefully enough people will recognize it and do something to fix it. Before Java ends up executing as fast as C++, and being as painful to work with as C++.</description>
		<content:encoded><![CDATA[<p>cyu,</p>
<p>Ruby is not immune from measuring the wrong thing, and I think there&#8217;s enough material for future posts on that.</p>
<p>But Java has a particular obsession, a doctrine for only measuring that which was JITted, probably dating back to when Java was fighting the performance war against C++. Right now, for most applications, it&#8217;s fast enough that we can start worrying about other things.</p>
<p>Some people don&#8217;t think the &#8220;waiting for the JIT&#8221; doctrine is a problem. But hopefully enough people will recognize it and do something to fix it. Before Java ends up executing as fast as C++, and being as painful to work with as C++.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: http://openid.claimid.com/cyu</title>
		<link>http://labnotes.org/2007/02/10/how-well-do-you-know-java/comment-page-1/#comment-137594</link>
		<dc:creator>http://openid.claimid.com/cyu</dc:creator>
		<pubDate>Sun, 11 Feb 2007 06:43:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.labnotes.org/2007/02/10/how-well-do-you-know-java/#comment-137594</guid>
		<description>Here&#039;s the problem with doing the measurement this way.  Say you benchmark some calculation in Java that took 0.1 seconds, bringing the total real time to 0.2 seconds (startup time + calculation time).  Not so bad, but what happens when you bring that calculation in your server in loop 1000 times, or is requested 1000 times simultaneously?  Using the real wait time measurement as your basis, you would estimate that the calculation executed in 200 seconds, when in reality it is probably about 100 seconds.  Then the measurement becomes significant.  So then you could ask, &#039;why not just include the looping into benchmark?&#039; - but that&#039;s not what you should do when benchmarking, you should only test the code you are concerned about, and in this case it is the calculation.

I don&#039;t see this as an issue of Ruby v. Java, as I can make the same statement above about Ruby and it would still apply (the number just wouldn&#039;t be as significant).  The issue is your criticism of a very valid benchmarking technique, and your statement that using it would lead to poor design decisions.</description>
		<content:encoded><![CDATA[<p>Here&#8217;s the problem with doing the measurement this way.  Say you benchmark some calculation in Java that took 0.1 seconds, bringing the total real time to 0.2 seconds (startup time + calculation time).  Not so bad, but what happens when you bring that calculation in your server in loop 1000 times, or is requested 1000 times simultaneously?  Using the real wait time measurement as your basis, you would estimate that the calculation executed in 200 seconds, when in reality it is probably about 100 seconds.  Then the measurement becomes significant.  So then you could ask, &#8216;why not just include the looping into benchmark?&#8217; &#8211; but that&#8217;s not what you should do when benchmarking, you should only test the code you are concerned about, and in this case it is the calculation.</p>
<p>I don&#8217;t see this as an issue of Ruby v. Java, as I can make the same statement above about Ruby and it would still apply (the number just wouldn&#8217;t be as significant).  The issue is your criticism of a very valid benchmarking technique, and your statement that using it would lead to poor design decisions.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

