Feat: Maximize performance for XML/HTML parsing

Open
#1,164 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@flovogt is already working on this.

Since Nov 14, 2026.

  • #1165 by @justinwilaby — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
html, typescript, wasm, xml

Research direction

Read the discussion on #1162 and inspect the parser call sites that create parsers, select event bitmasks, and call toJSON(); the issue does not name files or tests. Compare current XML parsing behavior and throughput before and after parser pooling and the event and serialization audits. Done means parser reuse is bounded, unnecessary events and toJSON() calls are removed where safe, and performance improves without changing parsing behavior.

Written by the indexing model from the issue text.

Description

Is your feature request related to a problem? Please describe.

Current sax-wasm implementations could be improved to maximize throughput, reduce time spent inside initialization sequences and tighten latencies.

Describe the solution you'd like

Strong candidates for quick wins
1. Introduce parser pooling

There's currently 1 parser per file which requires constructing a new parser and preparing the WASM several times with each run. Once the file is processed, the parser is thrown away even though it is designed to be re-used. A pool of parsers could be introduced so concurrency can be upheld and parsers re-used. Limiting parsers to a finite number would also prevent runaway memory growth on very high file counts - something that is a risk today.

2. Audit parser usage to trim unneeded events from the bitmask

Events such as OpenTag already contain the fully hydrated attributes making the Attributes event unneeded. Default event bitmasks could also contain more than is necessary. An audit could yield a minimal event bitmask for each usage which is more idiomatic and maps to better performance overall.

3. Audit toJSON() on data yielded from the parser

Calling toJSON() is expensive and only necessary when data from the parser crosses an async boundary. A quick scan of source code has not shown this behavior exists - omitting the toJSON() calls appears safe.

Describe alternatives you've considered

Leave this as-is and backlog for another day.

Additional context

This is a follow on to #1162 (see discussion). This affects XML parsing paths but is expected to have a modest effect on E2E. Nevertheless, this optimization is foundational if migrations to TS v7.2+ or OXC for AST traversal occur.

Dominant language
TypeScript
Stars
82
Forks
14
Avg merge
10h 17m
Merged PRs (30d)
13

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from UI5/linter

All issues in UI5/linter

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.