[infinispan-dev] [Discussion] TimeService implementation

Dan Berindei dan.berindei at gmail.com
Sat May 4 07:46:17 EDT 2013


On Fri, May 3, 2013 at 7:00 PM, Mircea Markus <mmarkus at redhat.com> 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 <pedro at infinispan.org> 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 - more of a nice to have ATM.
>
>
Actually, the performance optimization would be not to write the cached
time in preciseTime would be the performance optimization.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/infinispan-dev/attachments/20130504/5225f0f5/attachment.html 


More information about the infinispan-dev mailing list