I recently experimented with profiling code and found that the most convenient method, at least on Firefox, was to utilize either console
's time
/timeEnd
functions or profile
/profileEnd
methods, so I gave both a try.
The issue I encountered was the limited number of runs I could execute before Firefox crashed. While I won't present the code here due to its messy nature, the general idea is that it involves running functions (each representing a test) and logging their execution time for a specified number of iterations.
Although using 5e4 seemed somewhat effective, I believe it may not be sufficient to detect very small optimizations. Additionally, surpassing this threshold caused crashes.
How do you go about profiling your JavaScript? The current approach seems hardly viable in my experience.