Open davisjam opened 6 years ago
Can you please share the code that does that? It might be that the event loop has not run enough times to produce any meaningful data, but that's my take.
The event loop runs 0 (or perhaps 1?) times.
const DO_LOG = true;
function log (msg) {
if (DO_LOG) {
console.error(msg);
}
}
function fib (n) {
if (n <= 1) {
return 1;
}
return fib(n-1) + fib(n-2);
}
function main () {
for (let i = 0; i < 10; i++) {
for (let j = 30; j < 40; j++) {
const res = fib(j);
log(`fib(${j}) = ${res}`);
}
}
}
main();
I would say that it is the main issue. clinic is truly built to diagnose Node.js applications, not fully synchronous scripts - you might want to run clinic flame
directly on this type of things.
Understood, though this is not really reflected in the current documentation.
From my perspective, when exploring performance tools I usually start with something like Fibonacci, so having node-clinic appear to choke on this example is a bit unnerving.
Very interesting feedback, we should truly give a better output in this case. Something like:
clinic could not detect any I/O operation on this process. As such, it will be extremely hard to provide any recommendations. Consider using clinic flame directly.
Also, it should not throw an error, just fail gracefully.
From my perspective, when exploring performance tools I usually start with something like Fibonacci, so having node-clinic appear to choke on this example is a bit unnerving.
I typically use an "hello world" web server
20s of data should def be enough. I have a hunch this is caused by the profiler being started at nextTick to avoid profiling module loading. Let me investigate that a bit.
The error is being thown here, https://github.com/nearform/node-clinic/blob/master/bin.js#L226, so we should intercept that and print out a non-stack message instead
Still happens if I next the main fn, so prob something else.
const DO_LOG = true; function log (msg) { if (DO_LOG) { console.error(msg); } } function fib (n) { if (n <= 1) { return 1; } return fib(n-1) + fib(n-2); } function main () { for (let i = 0; i < 10; i++) { for (let j = 30; j < 40; j++) { const res = fib(j); log(`fib(${j}) = ${res}`); } } } main();
@mafintosh - I don't see an error being thrown here anymore. However, using the example from above we get a blank report from Doctor.
I am trying to use node clinic with the usual Fibonacci benchmark.
It runs 10 iterations of computing fib(30) to fib(40). This takes about 20 seconds.
Node clinic complains that there is not enough data. It does not say how much data it needs.