File tree 1 file changed +9
-3
lines changed
packages/core/data/dom-events
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -257,13 +257,19 @@ export class DOMEvent implements Event {
257
257
258
258
// Creating this upon class construction as an arrow function rather than as
259
259
// an inline function bound afresh on each usage saves about 210 nanoseconds
260
- // per run of handleEvent().
261
- private onCurrentListenersMutation = ( ) => {
260
+ // per run of dispatchTo().
261
+ //
262
+ // Creating it on the prototype and calling with the context instead saves a
263
+ // further 125 nanoseconds per run of dispatchTo().
264
+ //
265
+ // Creating it on the prototype and binding the context instead saves a
266
+ // further 30 nanoseconds per run of dispatchTo().
267
+ private onCurrentListenersMutation ( ) {
262
268
// Cloning the array via spread syntax is up to 180 nanoseconds
263
269
// faster per run than using Array.prototype.slice().
264
270
this . listenersLazyCopy = [ ...this . listenersLive ] ;
265
271
this . listenersLive . onMutation = null ;
266
- } ;
272
+ }
267
273
268
274
/**
269
275
* Dispatches a synthetic event event to target and returns true if either
You can’t perform that action at this time.
0 commit comments