<?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: Measuring Execution Time in Nanoseconds in Java</title>
	<atom:link href="http://www.robertpeaslee.com/index.php/measuring-execution-time-in-nanoseconds-in-java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robertpeaslee.com/index.php/measuring-execution-time-in-nanoseconds-in-java/</link>
	<description>Tales of rugged geek adventures, complete with traps.</description>
	<lastBuildDate>Sun, 22 Aug 2010 21:18:55 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: peasleer</title>
		<link>http://www.robertpeaslee.com/index.php/measuring-execution-time-in-nanoseconds-in-java/comment-page-1/#comment-394</link>
		<dc:creator>peasleer</dc:creator>
		<pubDate>Wed, 11 Feb 2009 03:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertpeaslee.com/index.php/measuring-execution-time-in-nanoseconds-in-java/#comment-394</guid>
		<description>Good tips, thanks for sharing. Yes, for the record, I was using them responsibly (difference of times only, no comparisons, and I was aware that their precision was limited by the most precise clock available). I hadn&#039;t read the bug report though, which is also good information to have. Thanks again Dave :)</description>
		<content:encoded><![CDATA[<p>Good tips, thanks for sharing. Yes, for the record, I was using them responsibly (difference of times only, no comparisons, and I was aware that their precision was limited by the most precise clock available). I hadn&#8217;t read the bug report though, which is also good information to have. Thanks again Dave :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Brenner</title>
		<link>http://www.robertpeaslee.com/index.php/measuring-execution-time-in-nanoseconds-in-java/comment-page-1/#comment-393</link>
		<dc:creator>David Brenner</dc:creator>
		<pubDate>Tue, 10 Feb 2009 19:46:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertpeaslee.com/index.php/measuring-execution-time-in-nanoseconds-in-java/#comment-393</guid>
		<description>Though I&#039;m sure you&#039;re using this method responsibly, it is important to note the inherent issues with using such a function to measure time. This bug report, specifically the Sun Developer&#039;s evaluation, addresses the most important issues (quoted from: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6519418):

- only use nanoTime values to compare against other nanoTime values obtained from within the same VM
- resolution (ie the smallest observable update) is dependent on OS and hardware platform but is never worse than currentTimeMillis(). I don&#039;t think giving examples is appropriate, but something like &quot;on an operating system with good hardware support a resolution on the order of tens of microseconds is not uncommon&quot;

I also think it is worth pointing out that to compare two nanoTime values,
long t0 = System.nanoTime();
...
long t1 = System.nanoTime();

one should not do
t0 &lt; t1
but instead do 
t1 - t0 &lt; 0
because of overflow</description>
		<content:encoded><![CDATA[<p>Though I&#8217;m sure you&#8217;re using this method responsibly, it is important to note the inherent issues with using such a function to measure time. This bug report, specifically the Sun Developer&#8217;s evaluation, addresses the most important issues (quoted from: <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6519418)" rel="nofollow">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6519418)</a>:</p>
<p>- only use nanoTime values to compare against other nanoTime values obtained from within the same VM<br />
- resolution (ie the smallest observable update) is dependent on OS and hardware platform but is never worse than currentTimeMillis(). I don&#8217;t think giving examples is appropriate, but something like &#8220;on an operating system with good hardware support a resolution on the order of tens of microseconds is not uncommon&#8221;</p>
<p>I also think it is worth pointing out that to compare two nanoTime values,<br />
long t0 = System.nanoTime();<br />
&#8230;<br />
long t1 = System.nanoTime();</p>
<p>one should not do<br />
t0 &lt; t1<br />
but instead do<br />
t1 &#8211; t0 &lt; 0<br />
because of overflow</p>
]]></content:encoded>
	</item>
</channel>
</rss>
