Skip to content

Commit 41a0fdf

Browse files
committed
fixup! perf_hooks: reduce overhead of new user timings
1 parent 5fd5fad commit 41a0fdf

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/internal/perf/usertiming.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,15 @@ function getMark(name) {
6666
return ts;
6767
}
6868

69-
const kEmptyArg = Symbol('kEmptyArg');
70-
7169
class PerformanceMark extends PerformanceEntry {
72-
constructor(name = kEmptyArg, options = undefined) {
73-
if (name === kEmptyArg) {
70+
constructor(name, options = undefined) {
71+
if (arguments.length === 0) {
7472
throw new ERR_MISSING_ARGS('name');
7573
}
7674
name = `${name}`;
7775
if (nodeTimingReadOnlyAttributes.has(name))
7876
throw new ERR_INVALID_ARG_VALUE('name', name);
79-
if (options !== undefined) {
77+
if (options != null) {
8078
validateObject(options, 'options');
8179
}
8280
const startTime = options?.startTime ?? now();
@@ -86,8 +84,6 @@ class PerformanceMark extends PerformanceEntry {
8684
markTimings.set(name, startTime);
8785

8886
let detail = options?.detail;
89-
// The usage of != is intentional, we want to skip structuredClone
90-
// for both undefined and null
9187
detail = detail != null ?
9288
structuredClone(detail) :
9389
null;

0 commit comments

Comments
 (0)