Add Mean / Fastest / Slowest for funcPerf stats
okor opened this issue · comments
In addition to the accumulative execution time stats for X number of function calls I think that mean, fastest and slowest (min/max) would also be very helpful data points. Thoughts?
@okor , yeah, this type of data would probably make sense for some people. I don't want to add too much because I want it to be simple and fast for people to use and understand. But I can see the information is useful.
Some clarification on what you think these values actually mean.
mean IsolatedTime - this is basically just IsolatedTime / CallCount - correct?
mean WholeTime - WholeTime / CallCount - correct?
Right now, the funcPerf sortBy option basically tells you what the max cumulative Isolated/Whole time is across the instrumented code - its the top row. I'm not sure anyone will care about the min times.
If you are thinking about max for any given SINGLE function call - the profiler doesn't really have any concept of that right now but I'm not sure if it's useful. Maybe it is.
I could also calculate standard deviations etc. but I'm not sure anyone would care...
Q: mean IsolatedTime - this is basically just IsolatedTime / CallCount - correct?
A: Yes, exactly.
Q: mean WholeTime - WholeTime / CallCount - correct?
A: Yep
My reasoning for asking for the mean/fastest/slowest metrics is to assist in finding troublesome functions, which might have deviations in performance depending on things like how many objects are passed into a function. For instance, a function that iterates over a list of objects and then applies a second iterator, etc. I've seen this a number of times when using functions from libraries like underscore inside of a loop. Seems harmless enough when writing the function, but that functions performance may vary wildly over the lifetime of the application session, depending on the context. Does that make sense?
@okor ,
OK, adding the columns AvgIsolatedTime, AvgWholeTime is pretty simple. And users could sortBy those fields as well fairly easily.
You have a good point about wild variance for a function depending on the data etc. Now I understand what you are going for. I don't think the mins are very useful though.
So, for each function reported in funcPerfs() I could also include maxIsolatedTime, maxWholeTime which is the maximum time for all of the times the function was invoked. I could also include the standard deviation but I'm not sure anyone would care / understand that metric.
I'm going to wait a day or two to make the change to make sure I'm not missing anything. Let me know what you think.
@okor - I just noticed you wrote a chrome extension before: https://chrome.google.com/webstore/detail/munin-dark-theme/fgboabpjnnfofdmknkijjpaolikljolo
Any chance you want to write a chrome extension for Kojak? It would be neat if the Kojak results were shown on a chrome tab nicely formatted etc...
I like the simplicity of adding the single "max" metric. I believe that would provide the data needed to spot unexpected performance variations. Like you mentioned, standard deviation is probably not necessary.
As for the plugin, I can look into it. My colleagues mentioned the same idea but we weren't sure if access restrictions would be a problem. Anyway, I think it's a good idea. If a regular plugin won't work, extending chrome dev tools is another possibility.