I Built a Tiny Function Profiler That Changed How I Debug JavaScript
dev.to·6h·
Discuss: DEV
🛡️Error Handling
Preview
Report Post

Have you ever wondered:

  • "Why is this function so slow?"
  • "How many times is this being called?"
  • "Where exactly is my code failing?"

I was asking myself these questions every single day. So I built a tool to answer them.

Introducing function-trace — a tiny, zero-dependency function profiler for JavaScript and TypeScript.


🤯 The Problem

Last month, I was debugging a production issue. An API endpoint was randomly slow, but I couldn’t figure out which function was the culprit.

My debugging process looked like this:

const start = performance.now();
const result = await someFunction();
const end = performance.now();
console.log(`someFunction took ${end - start}ms`);

I was copy-pasting this **ev…

Similar Posts

Loading similar posts...