Skip to content

Improve encode trie file size#1948

Merged
fb55 merged 8 commits intomainfrom
encode-size
Sep 4, 2025
Merged

Improve encode trie file size#1948
fb55 merged 8 commits intomainfrom
encode-size

Conversation

@fb55
Copy link
Owner

@fb55 fb55 commented Sep 4, 2025

Encodes the encode trie as a string, with a simple parser turning it into the previous structure on load. This leads to a 44% decrease in file size (from 24,034 to 13,392 bytes).

@fb55 fb55 requested a review from Copilot September 4, 2025 20:31

This comment was marked as outdated.

@fb55 fb55 requested a review from Copilot September 4, 2025 21:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the encode trie file size by replacing the previous object-based serialization with a compact string format, achieving a 44% reduction in bundle size (from 24,034 to 13,392 bytes).

  • Introduces a new string-based serialization format using delta encoding for trie structure
  • Replaces object property names (v, n, o) with descriptive names (value, next, nextValue)
  • Implements a parser to reconstruct the trie from the compact string representation

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/internal/encode-shared.ts Adds the new EncodeTrieNode type and parseEncodeTrie function for string-based trie parsing
src/encode.ts Updates property access to use descriptive names instead of abbreviated ones
scripts/write-encode-map.ts Replaces trie serialization logic with new string-based format generation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@fb55 fb55 enabled auto-merge (squash) September 4, 2025 22:06
@fb55 fb55 merged commit 0ff47b4 into main Sep 4, 2025
12 checks passed
@fb55 fb55 deleted the encode-size branch September 4, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants