mhart / gelf-stream

A node.js stream to send JS objects to a Graylog2 server (in GELF format)
Other
29 stars 13 forks source link

save a little on write() - moving conditions into intialization phase #17

Open apankov opened 7 years ago

apankov commented 7 years ago

Hey Michael, what do you think about micro-optimization? Thanks

mhart commented 7 years ago

Hmmm, I struggle to think of a scenario where this code path would make any real difference to performance considering this operation will be I/O bound.

Have you measured performance here – or was this a pre-emptive change?

apankov commented 7 years ago

That's rather pre-emptive strategy. I foresee my case where I'd like to collect lots of data per shot. I had very preliminary tests on big runs and got empirical understanding of performance penalties. I understand that's not the way how to measure performance, but anyway.