[web-devel] Caching the System time

Simon Meier iridcode at gmail.com
Thu Aug 18 14:38:11 CEST 2011

Hi Max,

if you're going for such a solution, then why not use difference lists
or even better bytestring builders as your representation of the
not-yet-flushed logging journal? Bytestring builders (from the
blaze-builder library) support a fast append and fast serialization
from a number of formats to bytestring.

best regards,

2011/8/10 Max Cantor <mxcantor at gmail.com>:
> 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