Skip to content

Intermediate values with console.time #84

Closed
@mattzeunert

Description

@mattzeunert

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.

console.time("abc")
console.timeEnd("abc")
console.timeEnd("abc")
// abc: 0.006ms
// abc: 0.281ms

The timer is reset only when time is called again with the same label. Firefox and Node remove the timer when timeEnd 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.

console.time("abc")
console.timeLog("abc")
console.timeEnd("abc")

Metadata

Metadata

Assignees

Labels

addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interest

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions