Commit 58a65d6
events: optimize condition for optimal scenario
Instead of always checking whether we've already warned about a
possible EventEmitter memory leak, first run the rest of the
code as accessing random properties on an Array is expensive.
In addition, remove an unnecessary truthy check.
PR-URL: #20452
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>1 parent 74685f1 commit 58a65d6Copy full SHA for 58a65d6
File tree
Expand file treeCollapse file tree
2 files changed
+15
-17
lines changedOpen diff view settings
Filter options
- benchmark/events
- lib
Expand file treeCollapse file tree
2 files changed
+15
-17
lines changedOpen diff view settings
Collapse file
benchmark/events/ee-add-remove.js
Copy file name to clipboardExpand all lines: benchmark/events/ee-add-remove.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | | - |
| 5 | + |
6 | 6 | |
7 | 7 | |
8 | 8 | |
|
Collapse file
+14-16Lines changed: 14 additions & 16 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | | - |
239 | | - |
240 | | - |
241 | | - |
242 | | - |
243 | | - |
244 | | - |
245 | | - |
246 | | - |
247 | | - |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | | - |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | + |
| 243 | + |
| 244 | + |
| 245 | + |
| 246 | + |
| 247 | + |
| 248 | + |
| 249 | + |
| 250 | + |
| 251 | + |
254 | 252 | |
255 | 253 | |
256 | 254 | |
|
0 commit comments