-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added sync mode #21
Added sync mode #21
Conversation
@@ -4,13 +4,14 @@ Extremely fast utf8-only stream implementation to write to files and | |||
file descriptors. | |||
|
|||
This implementation is partial, but support backpressure and `.pipe()` in is here. | |||
However, it is 20x faster than Node Core `fs.createWriteStream()`: | |||
However, it is 2-3x faster than Node Core `fs.createWriteStream()`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has the number dropped because Node's gotten faster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! 🚀
I also adjusted the benchmark to be more realistic
is this just a case of optimizing for benchmarks though? Does it show improvement in pino-http / hapi-pino benchmarks? |
Co-Authored-By: mcollina <matteo.collina@gmail.com>
Co-Authored-By: mcollina <matteo.collina@gmail.com>
It seems so, yes. In fact, we are slowing things down with pino-http for example by 30% when using sync mode. It's still 20% faster than a standard Node.js stream.
Not at all. TL;DR I will assemble a PR to fix pinojs/pino#542 when using the standard destination. We will lose throughput, but I think that type of behavior should be opt-in. Extreme mode will stay as is, and user will be given an option. |
My plan for pino is to have:
This should match the behavior of Node core as much as possible. |
|
This is mainly to solve pinojs/pino#542, however I found out that it gives us a 20% speed bump when logging things with sync mode in pino benchmarks.
Benchmarks in pino with sonic-boom master:
Benchmarks in pino with this PR, enabling sync mode for both destination and extreme:
cc @jsumners @davidmarkclements