[web-devel] Caching the System time

Greg Weber greg at gregweber.info
Fri Aug 5 20:11:03 CEST 2011


Thanks, that is good to know! Eventually we may look into caching just the
string for the logger that is generated from the time, but will be sure to
do some bench-marking first.

On Fri, Aug 5, 2011 at 10:47 AM, Bryan O'Sullivan <bos at serpentine.com>wrote:

> On Fri, Aug 5, 2011 at 7:57 AM, Greg Weber <greg at gregweber.info> wrote:
>
>>
>> We are finally getting around to implementing a robust logging solution
>> within Yesod. This creates the issue of having to frequently access the
>> system time. I see that Snap has a separate thread to get the system time
>> and cache the result [1].
>>
>
> That is an absurd non-optimisation. It costs just a few dozen nanoseconds
> to get the time of day under OS X, and Linux should be even cheaper since it
> doesn't involve a system call. It wouldn't surprise me if the approach above
> is actually *slower*.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110805/b4c423f6/attachment.htm>


More information about the web-devel mailing list