Comment

Comment by inshinrei

The primary purpose of the "halua" logger is to provide easy control over log levels and output systems in a single place

As of performance, let's address why "pino" is faster than console.log. Pino avoids using the console directly, as it is designed for the node environment and appears to utilize stdout.write for output. This approach gives Pino a performance advantage in benchmarks. As of now, "halua" is yet to be optimized. Your comment prompted me to conduct a quick benchmark tho. If you're interested, here are the results for 10_000 iterations:

// halua (console): 358ms (NewTextHandler(console.info))

// pino: 233ms

// halua (stdout): 253ms (NewTextHandler((data) => process.stdout.write(data)))

There's also JSON handler in halua, which is 10%-20% slower than text handler

parent inshinrei 1 year ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton