[web-devel] Caching the System time
greg at gregorycollins.net
Sat Aug 6 18:18:53 CEST 2011
FWIW: we don't cache the system time because it's slow to *get* it -- we
cache it because it's slow to turn it into a text string (for HTTP
responses, logging, etc). It still may be a stupid thing to do, but it
benchmarked faster when I wrote it.
On Fri, Aug 5, 2011 at 7:47 PM, 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 .
> 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*.
> web-devel mailing list
> web-devel at haskell.org
Gregory Collins <greg at gregorycollins.net>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the web-devel