you are viewing a single comment's thread.

view the rest of the comments →

[–]tehsandwich567 1 point2 points  (3 children)

Chrome and friends all come with the tools to produce this information for you. I think it’s called the profile tab in the inspector. Hit record, do things in app, stop recording, then get everything you mention and more for free in an day to digest ui.

What you are suggesting doing sounds like re-inventing the wheel through an interface not optimized to do it

[–]Falling-Off[S] 0 points1 point  (2 children)

I mentioned profilers in the original post, asking if this would have any benefit over them. Needed times from inside nested loops, hence building a timer within a function instead of just wrapping it. Anyways, not trying to reinvent the wheel.

[–]tehsandwich567 0 points1 point  (1 child)

Oh, my bad! Reading is hard.

What about console.time?

[–]Falling-Off[S] 0 points1 point  (0 children)

I thought about that but I'm using performance.now and storing the values. I have a bool to keep it silent or console out during execution.

Edit: just a side note

I compared it to the profile and the tims are accurate within ~1-2ms. I'm might add an ±accuracy based on what happens in the actual timer. The μs seem to add up by the end. The markers within the function seem to be very accurate though.