Skip to content
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

perf_hooks: measure() should allow endMark to be omitted #32647

Closed
pmer opened this issue Apr 3, 2020 · 1 comment
Closed

perf_hooks: measure() should allow endMark to be omitted #32647

pmer opened this issue Apr 3, 2020 · 1 comment

Comments

@pmer
Copy link

pmer commented Apr 3, 2020

  • Version: v13.12.0
  • Platform: Darwin 17.7.0 Darwin Kernel Version 17.7.0: Thu Jan 23 07:05:23 PST 2020; root:xnu-4570.71.69~1/RELEASE_X86_64 x86_64

What steps will reproduce the bug?

require('perf_hooks').performance.measure('name');

How often does it reproduce? Is there a required condition?

Always. No condition.

What is the expected behavior?

Undefined is returned.

What do you see instead?

Uncaught:
Error [ERR_INVALID_PERFORMANCE_MARK]: The "undefined" performance mark has not been set
    at Performance.measure (perf_hooks.js:402:13)
    at repl:1:35
    at Script.runInThisContext (vm.js:131:20)
    at REPLServer.defaultEval (repl.js:432:29)
    at bound (domain.js:429:14)
    at REPLServer.runBound [as eval] (domain.js:442:12)
    at REPLServer.onLine (repl.js:759:10)
    at REPLServer.emit (events.js:327:22)
    at REPLServer.EventEmitter.emit (domain.js:485:12)
    at REPLServer.Interface._onLine (readline.js:337:10) {
  code: 'ERR_INVALID_PERFORMANCE_MARK'
}

Additional information

Throwing an exception when an endMark parameter is is not passed to measure() is documented behavior in Node.js, but W3C User Timing Level 2 version 20190226 says it should default to a value of performance.now() if left undefined.

Node's documentation also states "This is the same Performance API as implemented in modern Web browsers," but in this case the behavior is different, because measure() does not throw an exception in this circumstance in evergreen web browsers.

@himself65
Copy link
Member

himself65 commented Apr 4, 2020

I'm working on this

targos pushed a commit that referenced this issue Apr 12, 2020
Make `startMark` and `endMark` parameters optional.

PR-URL: #32651
Fixes: #32647
Refs: https://www.w3.org/TR/user-timing-2/#measure-method
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BethGriggs pushed a commit that referenced this issue Apr 14, 2020
Make `startMark` and `endMark` parameters optional.

PR-URL: #32651
Fixes: #32647
Refs: https://www.w3.org/TR/user-timing-2/#measure-method
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this issue Apr 22, 2020
Make `startMark` and `endMark` parameters optional.

PR-URL: #32651
Fixes: #32647
Refs: https://www.w3.org/TR/user-timing-2/#measure-method
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants