| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fb8a23a commit 8a29296
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,6 @@ const { | |||
| 6 | 6 | MathCeil, | |
| 7 | 7 | ReflectApply, | |
| 8 | 8 | ReflectConstruct, | |
| 9 | - Symbol, | ||
| 10 | 9 | } = primordials; | |
| 11 | 10 | ||
| 12 | 11 | const { InternalPerformanceEntry } = require('internal/perf/performance_entry'); | |
@@ -35,8 +34,6 @@ const { | |||
| 35 | 34 | enqueue, | |
| 36 | 35 | } = require('internal/perf/observe'); | |
| 37 | 36 | ||
| 38 | - const kTimerified = Symbol('kTimerified'); | ||
| 39 | - | ||
| 40 | 37 | function processComplete(name, start, args, histogram) { | |
| 41 | 38 | const duration = now() - start; | |
| 42 | 39 | if (histogram !== undefined) | |
@@ -71,8 +68,6 @@ function timerify(fn, options = {}) { | |||
| 71 | 68 | histogram); | |
| 72 | 69 | } | |
| 73 | 70 | ||
| 74 | - if (fn[kTimerified]) return fn[kTimerified]; | ||
| 75 | - | ||
| 76 | 71 | const constructor = isConstructor(fn); | |
| 77 | 72 | ||
| 78 | 73 | function timerified(...args) { | |
@@ -95,11 +90,6 @@ function timerify(fn, options = {}) { | |||
| 95 | 90 | } | |
| 96 | 91 | ||
| 97 | 92 | ObjectDefineProperties(timerified, { | |
| 98 | - [kTimerified]: { | ||
| 99 | - configurable: false, | ||
| 100 | - enumerable: false, | ||
| 101 | - value: timerified, | ||
| 102 | - }, | ||
| 103 | 93 | length: { | |
| 104 | 94 | configurable: false, | |
| 105 | 95 | enumerable: true, | |
@@ -112,14 +102,6 @@ function timerify(fn, options = {}) { | |||
| 112 | 102 | } | |
| 113 | 103 | }); | |
| 114 | 104 | ||
| 115 | - ObjectDefineProperties(fn, { | ||
| 116 | - [kTimerified]: { | ||
| 117 | - configurable: false, | ||
| 118 | - enumerable: false, | ||
| 119 | - value: timerified, | ||
| 120 | - } | ||
| 121 | - }); | ||
| 122 | - | ||
| 123 | 105 | return timerified; | |
| 124 | 106 | } | |
| 125 | 107 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,16 +75,18 @@ const { | |||
| 75 | 75 | }); | |
| 76 | 76 | } | |
| 77 | 77 | ||
| 78 | - // Function can only be wrapped once, also check length and name | ||
| 78 | + // Function can be wrapped many times, also check length and name | ||
| 79 | 79 | { | |
| 80 | 80 | const m = (a, b = 1) => {}; | |
| 81 | 81 | const n = performance.timerify(m); | |
| 82 | 82 | const o = performance.timerify(m); | |
| 83 | 83 | const p = performance.timerify(n); | |
| 84 | - assert.strictEqual(n, o); | ||
| 85 | - assert.strictEqual(n, p); | ||
| 84 | + assert.notStrictEqual(n, o); | ||
| 85 | + assert.notStrictEqual(n, p); | ||
| 86 | + assert.notStrictEqual(o, p); | ||
| 86 | 87 | assert.strictEqual(n.length, m.length); | |
| 87 | 88 | assert.strictEqual(n.name, 'timerified m'); | |
| 89 | + assert.strictEqual(p.name, 'timerified timerified m'); | ||
| 88 | 90 | } | |
| 89 | 91 | ||
| 90 | 92 | (async () => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments