diff --git a/Cargo.lock b/Cargo.lock index 50b377c3..fa1ea97e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,12 +40,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bytecount" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" - [[package]] name = "cc" version = "1.0.83" @@ -215,12 +209,12 @@ name = "grep-searcher" version = "0.1.11" dependencies = [ "bstr", - "bytecount", "encoding_rs", "encoding_rs_io", "grep-matcher", "grep-regex", "log", + "memchr", "memmap2", "regex", ] diff --git a/crates/searcher/Cargo.toml b/crates/searcher/Cargo.toml index 68864cee..579d1370 100644 --- a/crates/searcher/Cargo.toml +++ b/crates/searcher/Cargo.toml @@ -15,19 +15,18 @@ edition = "2018" [dependencies] bstr = { version = "1.6.0", default-features = false, features = ["std"] } -bytecount = "0.6" encoding_rs = "0.8.14" encoding_rs_io = "0.1.6" grep-matcher = { version = "0.1.6", path = "../matcher" } log = "0.4.5" +memchr = "2.6.2" memmap = { package = "memmap2", version = "0.5.3" } [dev-dependencies] grep-regex = { version = "0.1.11", path = "../regex" } -regex = "1.1" +regex = "1.9.5" [features] -default = ["bytecount/runtime-dispatch-simd"] simd-accel = ["encoding_rs/simd-accel"] # This feature is DEPRECATED. Runtime dispatch is used for SIMD now. diff --git a/crates/searcher/src/lines.rs b/crates/searcher/src/lines.rs index 387a1b46..5e47c9b3 100644 --- a/crates/searcher/src/lines.rs +++ b/crates/searcher/src/lines.rs @@ -3,7 +3,6 @@ A collection of routines for performing operations on lines. */ use bstr::ByteSlice; -use bytecount; use grep_matcher::{LineTerminator, Match}; /// An iterator over lines in a particular slice of bytes. @@ -110,7 +109,7 @@ impl LineStep { /// Count the number of occurrences of `line_term` in `bytes`. pub fn count(bytes: &[u8], line_term: u8) -> u64 { - bytecount::count(bytes, line_term) as u64 + memchr::memchr_iter(line_term, bytes).count() as u64 } /// Given a line that possibly ends with a terminator, return that line without