Skip to content

Commit

Permalink
refactor: slightly optimized memmove footprint (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
pamburus authored Dec 29, 2024
1 parent 740fe37 commit 204fba6
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 102 deletions.
2 changes: 1 addition & 1 deletion 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = [".", "crate/encstr", "crate/heapopt"]
[workspace.package]
repository = "https://github.com/pamburus/hl"
authors = ["Pavel Ivanov <[email protected]>"]
version = "0.30.2-alpha.2"
version = "0.30.2-alpha.3"
edition = "2021"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ impl<'a, Formatter: RecordWithSourceFormatter, Filter: RecordFilter> SegmentProc
buf.push(b'\n');
}
parsed_some = true;
let record = self.parser.parse(ar.record);
let record = self.parser.parse(&ar.record);
if record.matches(&self.filter) {
let begin = buf.len();
buf.extend(prefix.as_bytes());
Expand Down
6 changes: 4 additions & 2 deletions src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ impl<'a> FieldFormatter<'a> {
s.element(Element::Null, |s| s.batch(|buf| buf.extend(b"null")));
}
RawValue::Object(value) => {
let item = value.parse().unwrap();
let mut item = model::Object::default();
value.parse_into(&mut item).ok();
s.element(Element::Object, |s| {
if !fs.flatten {
s.batch(|buf| buf.push(b'{'));
Expand All @@ -456,7 +457,8 @@ impl<'a> FieldFormatter<'a> {
}
RawValue::Array(value) => {
s.element(Element::Array, |s| {
let item = value.parse::<32>().unwrap();
let mut item = model::Array::default();
value.parse_into::<32>(&mut item).ok();
s.batch(|buf| buf.push(b'['));
let mut first = true;
for v in item.iter() {
Expand Down
2 changes: 1 addition & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ where
while let Some(item) = stream.next() {
match item {
Ok(ar) => {
let rec = self.parser.parse(ar.record);
let rec = self.parser.parse(&ar.record);
let mut flags = 0;
match rec.level {
Some(Level::Debug) => {
Expand Down
Loading

0 comments on commit 204fba6

Please sign in to comment.