microsoft/typescript-analyze-trace

Customizable thresholds constants

amcasey opened this issue · 5 comments

There are a bunch of constants that govern ultimately how many results are shown:

const thresholdDuration = 5E5; // microseconds
const minDuration = 1E5; // microseconds
const minPercentage = 0.6;

IMHO perhaps those constants should be customizable from the CLI, or even better there should just be a "limit" flag to limit the number of files outputted, which by default could be 10 or even the current essentially "auto" limit.

Was amcasey/ts-analyze-trace#7 from @fabiospampinato

@fabiospampinato while I agree with the sentiment, I'd be interested to know what values you're using and why - quite a bit of fine-tuning went into these, but they may be overfitted to the scenarios I've personally investigated.

@amcasey It's been a while since I last used this utility and I changed computer in the meantime so I don't have access to the tweaked values I had set anymore. If I remember correctly the tool was just giving me a fairly short list, while instead I wanted to see more entries.

@fabiospampinato Yeah, sorry it took so long to get this published for real.

When I want to see the full view, I usually open up the raw trace file in the browser, but I can see that there might be some value in getting the simplified stacks provided by this tool.

Given how heuristic the tool is, it seems quite possible to me that different thresholds (not just different threshold values) might be used in the future. How would you feel about having some sort of "sensitivity" parameter instead?

Maybe there should just be a --limit argument that decides how many entries are displayed (assuming there are at least that many), and by default the limit could be picked automatically?

I think I would prefer that over sensitivity thresholds because I wouldn't understand what they mean. Like at the end of the day I want the tool to return me either more or less entries, it seems an inherently numeric feature, if I want double the entries I just double the number.

Yes, the reason for exposing a "sensitivity" parameter would be to obscure its exact functionality, to avoid being constrained by specific requirements (e.g. number of stacks to produce).

I think I understand what you're getting at. I'll think some more about the best way to make the tool configurable so that users can see more or fewer results according to their needs. Fair warning: I think it makes sense to say "never show me more than 10 results" but not "never show me fewer than 10 results" - there may not be 10 points of interest.

Thanks for the feedback!