'Is there an equivalent tool like ruby-prof for node.js?

I want to profile a Jest test, but I only want to see the behavior for some specific methods. In ruby, I can do that with ruby-prof, but is there an equivalent tool like it for node.js or jest?



Solution 1:[1]

You can use console.time in node.js for the same if that's what you're looking for.

function myMethodInNode(){
  return 'hello world'
}
console.time("time starts for myMethodInNode");
 
myMethodInNode();
 
console.timeEnd("time ends for myMethodInNode");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ABGR