It turned out that GHC by default does "no buffering" for stderr, and for hslogger this might be a huge performance-bottleneck.
Here's an example of a script that confirms performance problems: https://gist.github.com/k-bx/ccf6fd1c73680c8a4345 (please, don't pay any attention to "timeout" thing, initiall I thought the problem lies in concurrent usage of hslogger).
In order to resolve problem, you can either manually put hSetBuffering stderr LineBuffering in your program, or disable logging to stderr at all.
I think that hslogger should do its best in order to not put a person into a situation when logging consumes huge amount of time, and I would propose to somehow determine that user is willing to use logging to stderr and in that case doing hSetBuffering stderr LineBuffering in order to switch buffering to LineBuffering mode.
It turned out that GHC by default does "no buffering" for stderr, and for hslogger this might be a huge performance-bottleneck.
Here's an example of a script that confirms performance problems: https://gist.github.com/k-bx/ccf6fd1c73680c8a4345 (please, don't pay any attention to "timeout" thing, initiall I thought the problem lies in concurrent usage of hslogger).
In order to resolve problem, you can either manually put
hSetBuffering stderr LineBufferingin your program, or disable logging to stderr at all.I think that hslogger should do its best in order to not put a person into a situation when logging consumes huge amount of time, and I would propose to somehow determine that user is willing to use logging to stderr and in that case doing
hSetBuffering stderr LineBufferingin order to switch buffering toLineBufferingmode.