[web-devel] Caching the System time

Gregory Collins greg at gregorycollins.net
Wed Aug 10 08:16:46 CEST 2011


On Wed, Aug 10, 2011 at 6:20 AM, Max Cantor <mxcantor at gmail.com> wrote:
> Just curious, but might it be faster to:
>
> replace the MVar handle with an IORef [Data.Sequence.Seq String]
> logs are appended with atomicModifyIORef
> then every n seconds, a worker thread uses atomicModifyIORef to clear the sequence and write the log messages to a handle?
>
> this way, logging a message doesn't require taking an mvar
>
> I have no idea if this is better, just thought i'd throw it out.

That's exactly what snap-server does in its logging code.

G
-- 
Gregory Collins <greg at gregorycollins.net>



More information about the web-devel mailing list