Skip to content

Commit

Permalink
try more limited escape check
Browse files Browse the repository at this point in the history
Signed-off-by: Luke Steensen <[email protected]>
  • Loading branch information
lukesteensen committed Nov 15, 2023
1 parent 2d73ac7 commit 222ee68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
11 changes: 9 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion lib/vector-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions lib/vector-core/src/event/estimated_json_encoded_size_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 222ee68

Please sign in to comment.