<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 3, 2013 at 7:00 PM, Mircea Markus <span dir="ltr">&lt;<a href="mailto:mmarkus@redhat.com" target="_blank">mmarkus@redhat.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 3 May 2013, at 16:54, Pedro Ruivo wrote:<br>
<br>
&gt; On 05/03/2013 04:49 PM, Manik Surtani wrote:<br>
&gt;&gt;<br>
&gt;&gt; On 2 May 2013, at 19:01, Pedro Ruivo &lt;<a href="mailto:pedro@infinispan.org">pedro@infinispan.org</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; preciseTime() {return (cached = System.nanoTime());}<br>
&gt;&gt;&gt; impreciseTime() {return cached;}<br>
&gt;&gt;<br>
&gt;&gt; How would you invalidate the cached time?<br>
&gt;<br>
&gt; My idea is to have a schedule thread updating the cached time. the<br>
&gt; preciseTime() is just an optimization to keep the cached value more<br>
&gt; up-to-date since we are calculating the nanoTime() (and assuming that<br>
&gt; nanoTime() is more expensive than write in the volatile variable).<br>
<br>
</div>Sounds like a good idea but please don&#39;t implement that for now. That&#39;s a performance optimisation and would require benchmarking to prove it&#39;s worth doing - more of a nice to have ATM.<br>
<div class="im HOEnZb"><br></div></blockquote><div><br></div><div style>Actually, the performance optimization would be not to write the cached time in preciseTime would be the performance optimization.</div><div style><br>

</div></div></div></div>