From 3761cdcdb45bcd11c1d8261ecdf53a524ce0d30d Mon Sep 17 00:00:00 2001 From: Spencer Whitehead Date: Wed, 27 Dec 2023 23:46:42 -0500 Subject: [PATCH 1/2] refac: improve lexing inline elements step's performance --- src/Lexer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Lexer.ts b/src/Lexer.ts index b26a1cb407..f76964e72a 100644 --- a/src/Lexer.ts +++ b/src/Lexer.ts @@ -89,8 +89,8 @@ export class _Lexer { this.blockTokens(src, this.tokens); - let next; - while (next = this.inlineQueue.shift()) { + for (let i = 0; i < this.inlineQueue.length; i++) { + const next = this.inlineQueue[i]; this.inlineTokens(next.src, next.tokens); } From fdc35256d4c654f5493436155a7f8bf44dba85ac Mon Sep 17 00:00:00 2001 From: Spencer Whitehead Date: Fri, 29 Dec 2023 11:19:53 -0500 Subject: [PATCH 2/2] refac: clear out queue after tokens have been inlined --- src/Lexer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Lexer.ts b/src/Lexer.ts index f76964e72a..d6be1afd3c 100644 --- a/src/Lexer.ts +++ b/src/Lexer.ts @@ -93,6 +93,7 @@ export class _Lexer { const next = this.inlineQueue[i]; this.inlineTokens(next.src, next.tokens); } + this.inlineQueue = []; return this.tokens; }