-
-
Notifications
You must be signed in to change notification settings - Fork 37.2k
doc: main perf_hooks example throws when async #40558
Copy link
Copy link
Closed as not planned
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.perf_hooksIssues and PRs related to the perf_hooks module and performance measurement APIs.Issues and PRs related to the perf_hooks module and performance measurement APIs.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
Description
Activity
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.perf_hooksIssues and PRs related to the perf_hooks module and performance measurement APIs.Issues and PRs related to the perf_hooks module and performance measurement APIs.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
📗 API Reference Docs Problem
perf_hooksLocation
Section of the site where the content exists
Affected URL(s):
Description
Concise explanation of the problem
Simply defining
will make the example throw.
The available fixes are, to my knowledge
doSomeLongRunningProcesssync (e.g.const doSomeLongRunningProcess = (f) => f())performance.measure('Start to Now')performance.clearMarks()I think the proper solution is 3.
Additionally, the performance observer only emits the first entry.
A more proper example would be the following, as it handles the edge cases gracefully:
submit a pull request.