diff --git a/lib/internal/perf/timerify.js b/lib/internal/perf/timerify.js index dae0b06bf80c8a..6bfede7aa1fa20 100644 --- a/lib/internal/perf/timerify.js +++ b/lib/internal/perf/timerify.js @@ -6,7 +6,6 @@ const { MathCeil, ReflectApply, ReflectConstruct, - Symbol, } = primordials; const { InternalPerformanceEntry } = require('internal/perf/performance_entry'); @@ -35,8 +34,6 @@ const { enqueue, } = require('internal/perf/observe'); -const kTimerified = Symbol('kTimerified'); - function processComplete(name, start, args, histogram) { const duration = now() - start; if (histogram !== undefined) @@ -71,8 +68,6 @@ function timerify(fn, options = {}) { histogram); } - if (fn[kTimerified]) return fn[kTimerified]; - const constructor = isConstructor(fn); function timerified(...args) { @@ -95,11 +90,6 @@ function timerify(fn, options = {}) { } ObjectDefineProperties(timerified, { - [kTimerified]: { - configurable: false, - enumerable: false, - value: timerified, - }, length: { configurable: false, enumerable: true, @@ -112,14 +102,6 @@ function timerify(fn, options = {}) { } }); - ObjectDefineProperties(fn, { - [kTimerified]: { - configurable: false, - enumerable: false, - value: timerified, - } - }); - return timerified; } diff --git a/test/parallel/test-performance-function.js b/test/parallel/test-performance-function.js index ea928028208e47..fcc3004d02884a 100644 --- a/test/parallel/test-performance-function.js +++ b/test/parallel/test-performance-function.js @@ -75,16 +75,18 @@ const { }); } -// Function can only be wrapped once, also check length and name +// Function can be wrapped many times, also check length and name { const m = (a, b = 1) => {}; const n = performance.timerify(m); const o = performance.timerify(m); const p = performance.timerify(n); - assert.strictEqual(n, o); - assert.strictEqual(n, p); + assert.notStrictEqual(n, o); + assert.notStrictEqual(n, p); + assert.notStrictEqual(o, p); assert.strictEqual(n.length, m.length); assert.strictEqual(n.name, 'timerified m'); + assert.strictEqual(p.name, 'timerified timerified m'); } (async () => {