Skip to content

Commit

Permalink
perf(parser): Speed up UTF-8 validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed Apr 28, 2021
1 parent 819702c commit 6b92e34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/typos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ thiserror = "1.0"
regex = "1.3"
once_cell = "1.2.0"
serde = { version = "1.0", features = ["derive"] }
simdutf8 = "0.1.1"
itertools = "0.10"
log = "0.4"
unicode-segmentation = "1.7.1"
2 changes: 1 addition & 1 deletion crates/typos/src/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl<'s> Iterator for Utf8Chunks<'s> {
if self.source.is_empty() {
return None;
}
match std::str::from_utf8(self.source) {
match simdutf8::compat::from_utf8(self.source) {
Ok(valid) => {
self.source = b"";
return Some(valid);
Expand Down

0 comments on commit 6b92e34

Please sign in to comment.