[web-devel] Caching the System time

Michael Snoyman michael at snoyman.com
Wed Aug 10 06:30:48 CEST 2011


Did you mean IORef (Data.Sequence.Seq String)? I'm wondering if a Chan
might be even better than that.

On Wed, Aug 10, 2011 at 7: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.
>
> On Aug 10, 2011, at 11:17 AM, Kazu Yamamoto (山本和彦) wrote:
>
>>  Every user-thread of Mighttpd records a log message with Handle.
>>  Since Handle is protected with MVar, serialization is done. Multiple
>>  log messages are buffered in the buffer of Handle to reduce the
>>  number of the write system call. Moreover, I re-implemented hPut to
>>  reduce unnecessary intermediate data to compose a log message.
>
>
> _______________________________________________
> web-devel mailing list
> web-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/web-devel
>



More information about the web-devel mailing list