Skip to content

Unboxed tokens#257

Merged
orium merged 10 commits intomasterfrom
unboxed-tokens
Feb 4, 2025
Merged

Unboxed tokens#257
orium merged 10 commits intomasterfrom
unboxed-tokens

Conversation

@kornelski
Copy link
Contributor

This may be easier to review this as individual commits, since big diffs are from splitting and renaming files.

This refactoring removes TokenCapturer and TokenCapturerEvent, which enables Lexeme::to_token to be inlined. This way the Token isn't moved around as much, and it's not necessary to use Box<Token>.

This allowed TextDecoder to be simplified, and handle just the decoding, similar to TextEncoder. I've added a fast path for handling text chunks, with zero-copy for UTF-8 and ASCII. It could have been even faster, if it didn't keep the existing tricky behavior: #255.

Overall, it makes most benchmarks 5-8% faster, with 25-40% faster on text-heavy documents.

@kornelski kornelski force-pushed the unboxed-tokens branch 3 times, most recently from f81165f to ec78225 Compare January 6, 2025 14:46
@orium orium merged commit b5b1a1e into master Feb 4, 2025
5 checks passed
@orium orium deleted the unboxed-tokens branch February 4, 2025 16:45
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