Skip to content

Commit ab56e11

Browse files
committed
fix: C for loop instead of for...of
1 parent eb8020a commit ab56e11

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/data/dom-events/dom-event.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,10 @@ export class DOMEvent implements Event {
331331
const eventPath = this.getEventPath(target, 'capture');
332332

333333
// Capturing phase, e.g. [Page, StackLayout, Button]
334-
for (const currentTarget of eventPath) {
334+
// This traditional C loop runs 150 nanoseconds faster than a for...of
335+
// loop.
336+
for (let i = 0; i < eventPath.length; i++) {
337+
const currentTarget = eventPath[i];
335338
this.currentTarget = currentTarget;
336339
this.eventPhase = this.target === this.currentTarget ? this.AT_TARGET : this.CAPTURING_PHASE;
337340

0 commit comments

Comments
 (0)