diff --git a/Cargo.lock b/Cargo.lock index 2f9cdf095b741..bd25c7da08324 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1759,6 +1759,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bytecount" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" + [[package]] name = "bytemuck" version = "1.14.0" @@ -5584,7 +5590,8 @@ dependencies = [ [[package]] name = "ntapi" version = "0.3.7" -source = "git+https://github.com/MSxDOS/ntapi.git?rev=24fc1e47677fc9f6e38e5f154e6011dc9b270da6#24fc1e47677fc9f6e38e5f154e6011dc9b270da6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" dependencies = [ "winapi", ] @@ -10222,6 +10229,7 @@ dependencies = [ "async-trait", "base64 0.21.5", "bitmask-enum", + "bytecount", "bytes 1.5.0", "chrono", "chrono-tz", @@ -10239,7 +10247,6 @@ dependencies = [ "http", "hyper-proxy", "indexmap 2.1.0", - "memchr", "metrics", "metrics-tracing-context", "metrics-util", diff --git a/lib/vector-core/Cargo.toml b/lib/vector-core/Cargo.toml index b8bfb38eb49b8..b621e1db5120f 100644 --- a/lib/vector-core/Cargo.toml +++ b/lib/vector-core/Cargo.toml @@ -63,7 +63,7 @@ vector-config = { path = "../vector-config" } vector-config-common = { path = "../vector-config-common" } vector-config-macros = { path = "../vector-config-macros" } vrl.workspace = true -memchr = "2.6.4" +bytecount = "0.6.7" [target.'cfg(target_os = "macos")'.dependencies] security-framework = "2.9.2" diff --git a/lib/vector-core/src/event/estimated_json_encoded_size_of.rs b/lib/vector-core/src/event/estimated_json_encoded_size_of.rs index 933118d7b3411..038129b71d61e 100644 --- a/lib/vector-core/src/event/estimated_json_encoded_size_of.rs +++ b/lib/vector-core/src/event/estimated_json_encoded_size_of.rs @@ -97,8 +97,7 @@ impl EstimatedJsonEncodedSizeOf for str { // serializing to JSON. The goal is improve our overall accuracy in the case of relatively common // scenarios like strings of nested JSON, etc. fn count_escapes(input: &[u8]) -> usize { - memchr::memchr3_iter(b'"', b'\\', b'\t', input).count() - + memchr::memchr2_iter(b'\n', b'\r', input).count() + bytecount::count(input, b'"') } impl EstimatedJsonEncodedSizeOf for String {