Answer the question
In order to leave comments, you need to log in
Measuring the execution time of a piece of code, in node.js?
I have been sitting on a sharp for a long time and tightly (from his birth). I’m looking at js (what really, what is that) - like an old ram to a new gate))
what I ask for help, as in a node (yes, I’m trying to start not from browsers, but from my territory - the system)) .. on a clean js to make an analogue of measuring the execution time of a code fragment
internal static situation startEmptyFlop()
{
#if DEBUG
var sw = new Stopwatch();
sw.Start();
#endif
/// bla-bla-bla
#if DEBUG
sw.Stop();
var ts = sw.Elapsed;
$"\t{ts.Hours:00}:{ts.Minutes:00}:{ts.Seconds:00}.{ts.Milliseconds:000}".log();
#endif
return s;
}
Answer the question
In order to leave comments, you need to log in
function startEmptyFlop() {
console.time('Watcher');
// bla-bla-bla
console.timeEnd('Watcher');
}
> startEmptyFlop()
Watcher: 0.007ms
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question