On 3 May 2013, at 17:00, Mircea Markus <[email protected]> wrote:

> 
> On 3 May 2013, at 16:54, Pedro Ruivo wrote:
> 
>> On 05/03/2013 04:49 PM, Manik Surtani wrote:
>>> 
>>> On 2 May 2013, at 19:01, Pedro Ruivo <[email protected]> wrote:
>>> 
>>>> 
>>>> preciseTime() {return (cached = System.nanoTime());}
>>>> impreciseTime() {return cached;}
>>> 
>>> How would you invalidate the cached time?
>> 
>> My idea is to have a schedule thread updating the cached time. the 
>> preciseTime() is just an optimization to keep the cached value more 
>> up-to-date since we are calculating the nanoTime() (and assuming that 
>> nanoTime() is more expensive than write in the volatile variable).
> 
> 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 

Exactly.  You may well find that this is what the JDK does anyway.  Plus the 
cost of a scheduled thread (context switching, volatile write, etc) may not 
really be worth the perceived benefits.

--
Manik Surtani
[email protected]
twitter.com/maniksurtani

Platform Architect, JBoss Data Grid
http://red.ht/data-grid


_______________________________________________
infinispan-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/infinispan-dev

Reply via email to