[web-devel] Caching the System time

Max Cantor mxcantor at gmail.com
Wed Aug 10 06:20:03 CEST 2011


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.




More information about the web-devel mailing list