Skip to content

refactor: Don't concatenate strings#1045

Merged
fb55 merged 7 commits intomasterfrom
refactor/tokenizer-indices
Dec 28, 2021
Merged

refactor: Don't concatenate strings#1045
fb55 merged 7 commits intomasterfrom
refactor/tokenizer-indices

Conversation

@fb55
Copy link
Owner

@fb55 fb55 commented Dec 14, 2021

Refactors tokenizer callbacks to pass indices instead of strings. This allows us to avoid most string concatenations, which will speed things up in production.

This should also help with memory bloat: V8 doesn't garbage collect strings with slices still being referenced.

Note: AndreasMadsen/htmlparser-benchmark only parses whole documents. As a consequence, there is no speedup with this change.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1580285346

  • 328 of 331 (99.09%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.5%) to 98.991%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Tokenizer.ts 238 241 98.76%
Files with Coverage Reduction New Missed Lines %
src/Tokenizer.ts 1 98.75%
Totals Coverage Status
Change from base Build 1580203836: -0.5%
Covered Lines: 785
Relevant Lines: 793

💛 - Coveralls

@fb55 fb55 merged commit fab8c4c into master Dec 28, 2021
@fb55 fb55 deleted the refactor/tokenizer-indices branch December 28, 2021 18:56
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