tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jess Holle <>
Subject Re: 6.x feature wishlist
Date Tue, 07 Aug 2007 23:33:33 GMT
Filip Hanik - Dev Lists wrote:
> Jess Holle wrote:
>> Tim Funk wrote:
>>>> 11.Timestamps & System.currentTimeMillis
>>>>   System.currentTimeMillis is invoked everywhere during the chain 
>>>> of events for a HTTP requests, even though most dates only need 
>>>> precision down to the second.
>>>>   I've received feedback that this could be improved by keeping a 
>>>> time service, that updates a timestamp every second, and therefor 
>>>> reduces the number of system calls
>>>>   I think we would need to prove the theory before committing to 
>>>> the implementation, but that should be pretty easy
>> System.currentTimeMillis() is *very* fast.  [System.nanoTime() is not 
>> necessarily and can be relatively slow on some hardware.]
>> Many algorithms used to format System.currentTimeMillis() into a 
>> human readable date format are fairly slow.  I'm not sure what Tomcat 
>> is currently using here, but that would be the only thing I'd be 
>> concerned about.  It would seem sufficient just to make sure this 
>> conversion is efficient and/or not called with any ridiculous frequency.
> good info, all we use is the millis version, then we don't need to 
> worry about it
Yes, if you just call System.currentTimeMillis() and pass along the long 
this is all but free (essentially it just reads a long out of volatile 
memory address).

If you're repeatedly formatting this into date strings, then some 
profiling is likely in order.

Jess Holle

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message