<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/performance-metrics-and-benchmarking-on-node-js-a2vyt0dfa" -->

---
title: Performance metrics and benchmarking on Node.js | daily.dev
description: A practical walkthrough of measuring function execution time in Node.js using the built-in perf_hooks module, covering performance.mark, performance.measure,...
canonical: https://daily.dev/posts/performance-metrics-and-benchmarking-on-node-js-a2vyt0dfa
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Performance metrics and benchmarking on Node.js | daily.dev
og:description: A practical walkthrough of measuring function execution time in Node.js using the built-in perf_hooks module, covering performance.mark, performance.measure,...
og:url: https://daily.dev/posts/performance-metrics-and-benchmarking-on-node-js-a2vyt0dfa
og:image: https://api.daily.dev/og/posts/a2vYT0dfA.png
og:image:alt: Performance metrics and benchmarking on Node.js
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Performance metrics and benchmarking on Node.js

**[Yagiz Nizipli](https://daily.dev/sources/yagiz)** · 2 min read · 0 upvotes · 0 comments

## Summary

A practical walkthrough of measuring function execution time in Node.js using the built-in perf_hooks module, covering performance.mark, performance.measure, and PerformanceObserver for logging durations. It also demonstrates benchmarking multiple implementations (e.g., bubble sort vs quicksort) using the 'benchmark' library to compare operations per second.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.yagiz.co/performance-metrics-and-benchmarking-nodejs>

## Questions this post answers

### How do I measure how long a function takes to execute in Node.js?

Use the perf_hooks module's performance.mark to set start and end markers around the code, then call performance.measure with a name and the two marker names to compute the duration. A PerformanceObserver registered with entryTypes ['measure'] and buffered true can then log each entry's name and duration in milliseconds.

_daily.dev surfaces practical Node.js performance techniques for developers optimizing slow functions._

### How can I compare the speed of two different JavaScript implementations, like bubble sort versus quicksort?

Use the benchmark library's Benchmark.Suite to add each implementation as a named test case with the same input data, then run the suite asynchronously. It reports operations per second for each case and logs the fastest one on completion, giving a concrete comparison rather than a single timing snapshot.

_developers deciding between algorithm implementations can find benchmarking approaches like this on daily.dev._

## Similar posts on daily.dev

- [Performance Hints](https://daily.dev/posts/performance-hints-eqeu2vzz8) · Hacker News · 0 upvotes · 0 comments
- [JavaScript Event Loop Explained: Queue Tracing and Debugging Guide](https://daily.dev/posts/javascript-event-loop-explained-queue-tracing-and-debugging-guide-sa0thbcrm) · SitePoint · 148 upvotes · 4 comments
- [The Node.js built-in test runner](https://daily.dev/posts/the-node-js-built-in-test-runner-qw7ywroa9) · Flavio Copes · 0 upvotes · 0 comments
- [Debugging Performance in PHP](https://daily.dev/posts/debugging-performance-in-php-4dll06a7g) · PHPUnit Expert · 9 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#performance](https://daily.dev/tags/performance), [#nodejs](https://daily.dev/tags/nodejs)

[View this post on daily.dev](https://daily.dev/posts/performance-metrics-and-benchmarking-on-node-js-a2vyt0dfa)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Performance metrics and benchmarking on Node.js","url":"https://daily.dev/posts/performance-metrics-and-benchmarking-on-node-js-a2vyt0dfa","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/performance-metrics-and-benchmarking-on-node-js-a2vyt0dfa"},"datePublished":"2026-09-13T19:57:37.705Z","dateModified":"2026-09-13T20:01:38.133Z","description":"A practical walkthrough of measuring function execution time in Node.js using the built-in perf_hooks module, covering performance.mark, performance.measure,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/215d844a08c1dcba086dad8a8e6e2bed?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/215d844a08c1dcba086dad8a8e6e2bed?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Yagiz Nizipli","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Yagiz Nizipli","logo":"https://media.daily.dev/image/upload/s--9Cscmaqk--/f_auto,q_auto/v1789329427/logos/yagiz?_a=BAMAMicg0","url":"https://daily.dev/sources/yagiz"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/performance-metrics-and-benchmarking-on-node-js-a2vyt0dfa","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,performance,nodejs","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Yagiz Nizipli","item":"https://daily.dev/sources/yagiz"},{"@type":"ListItem","position":3,"name":"Performance metrics and benchmarking on Node.js"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/performance-metrics-and-benchmarking-on-node-js-a2vyt0dfa#faq","mainEntity":[{"@type":"Question","name":"How do I measure how long a function takes to execute in Node.js?","acceptedAnswer":{"@type":"Answer","text":"Use the perf_hooks module's performance.mark to set start and end markers around the code, then call performance.measure with a name and the two marker names to compute the duration. A PerformanceObserver registered with entryTypes ['measure'] and buffered true can then log each entry's name and duration in milliseconds. daily.dev surfaces practical Node.js performance techniques for developers optimizing slow functions."}},{"@type":"Question","name":"How can I compare the speed of two different JavaScript implementations, like bubble sort versus quicksort?","acceptedAnswer":{"@type":"Answer","text":"Use the benchmark library's Benchmark.Suite to add each implementation as a named test case with the same input data, then run the suite asynchronously. It reports operations per second for each case and logs the fastest one on completion, giving a concrete comparison rather than a single timing snapshot. developers deciding between algorithm implementations can find benchmarking approaches like this on daily.dev."}}]}
```

