Skip to content

Enable by-line buffering for stderr #33

@k-bx

Description

@k-bx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions