Skip to content

Confused - why is a trie used here? #1926

@KTibow

Description

@KTibow

I don't see why a trie is used here. Tries are good when prefixes group items logically or when you're genuinely receiving one character at a time, but I don't think this happens in HTML entities. Using a trie is making the bundle size larger:

Compression decode-data-html.ts entities.json + legacy.json
None 47,759b 34,333b (72%)
gzip -c 19,589b 11,620b (59%)
zstd --ultra -22 16,651b 10,730b (64%)

This isn't isolated. entities is substantially larger than html-entities (compare: entities vs html-entities), and takes up half of the htmlparser2 bundle (visualization) because of that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions