Over the years, I found myself searching for the same exact problem whenever I was using Knex.js, the query planner for Node.js. Since, the following code snippet is small enough to not be a Node library, I'm intrigued to share this as a blog post.
Initially, a blog post from Atomic Object proposed to use query and query-response events on the knex.js instance, since it's also an event emitter, but I guess it's time to use perf_hooks and properly mark the performance of a query using the native tooling.
You might also like...
Implementing Node.js URL parser in WebAssembly with Rust