-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intermediate values with console.time #84
Comments
I think this is a great idea. It would be easy to implement this in WebKit. I'd be happy to do it. |
The new timeLog function, or the timeEnd-can-be-called-multiple-times behavior? |
Allowing |
Anyone knows when (and why) did Chrome's behavior change? According to nodejs/node#3562, it used to remove the timer after a call to |
It looks to me like this change / (review). Not sure if that was intention or not as it doesn't appear to be mentioned in the commit message, but code inspection looks like it might have done it (see difference between |
/cc @ak239 |
As of at least now, Chrome's behavior is back to removing the timer from the associated timer table. In other words,
I'd be happy to implement either in Chrome, but I'd like to here from @JosephPecoraro (who likely still prefers multiple calls to |
I prefer adding a new timeLog function, since then it can be more easily feature detected. |
cc: @nchevobbe @bakulf I also prefer a new function because:
|
Makes sense to me and it seems we have consensus here. |
I'm wondering, perhaps it might be helpful to have an extra label as well that gets printed on the same line:
|
I think that would make sense. I used to do things like : console.group("Load Page");
console.time("load json");
console.timeEnd("load json");
console.time("app rendered");
console.timeEnd("app rendered");
console.groupEnd("Load Page"); so with |
The extra label seems pretty helpful with this intermediate |
Instead of having an extra DOMString parameter, I think it would be better to have: |
For the record, this landed in Firefox 62.0a1 (2018-05-22) (See Bug 1461001) |
@nchevobbe Great to hear, thanks for the update! I'll get a spec PR going. |
I've posted a PR for this, would welcome anyone taking a look and providing feedback. |
If anyone (@nchevobbe perhaps since FF has implemented) wants to check out the spec PR #138 for this that'd be great! We should be able to land this relatively soon, just want to get some eyes on the PR before I write some tests. |
There should be a way to print how much time has passed since a timer has started without removing the timer.
In Chrome calling
timeEnd
currently doesn't remove the timer, so you can call timeEnd multiple times.The timer is reset only when
time
is called again with the same label. Firefox and Node remove the timer whentimeEnd
is called, as the spec says.To be able to see intermediate values the spec could either be changed to recommend Chrome's behavior, or a new
timeLog
(or similar) function could be introduced, which prints the duration without affecting the timer itself.The text was updated successfully, but these errors were encountered: