<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"><<a href="mailto:mmarkus@redhat.com" target="_blank">mmarkus@redhat.com</a>></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>
> On 05/03/2013 04:49 PM, Manik Surtani wrote:<br>
>><br>
>> On 2 May 2013, at 19:01, Pedro Ruivo <<a href="mailto:pedro@infinispan.org">pedro@infinispan.org</a>> wrote:<br>
>><br>
>>><br>
>>> preciseTime() {return (cached = System.nanoTime());}<br>
>>> impreciseTime() {return cached;}<br>
>><br>
>> How would you invalidate the cached time?<br>
><br>
> My idea is to have a schedule thread updating the cached time. the<br>
> preciseTime() is just an optimization to keep the cached value more<br>
> up-to-date since we are calculating the nanoTime() (and assuming that<br>
> nanoTime() is more expensive than write in the volatile variable).<br>
<br>
</div>Sounds like a good idea but please don't implement that for now. That's a performance optimisation and would require benchmarking to prove it'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>