Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start parsing the chunks file with serde #31

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use memchr-based splitting instead of an iterator/event-based inter…
…face
  • Loading branch information
Swatinem committed Nov 19, 2024
commit e47f552f5eae7063147c1b4857f61972aad03666
1 change: 1 addition & 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 core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ testing = []

[dependencies]
include_dir = "0.7.3"
memchr = "2.7.4"
memmap2 = "0.9.5"
rand = "0.8.5"
rusqlite = { version = "0.31.0", features = [
22 changes: 6 additions & 16 deletions core/benches/pyreport.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::HashMap;
use std::{collections::HashMap, hint::black_box};

use codecov_rs::{
parsers::pyreport::{chunks, chunks_serde, report_json},
@@ -146,21 +146,11 @@ fn complex_chunks_serde(bencher: Bencher) {
}

fn parse_chunks_file_serde(input: &[u8]) {
let mut parser = chunks_serde::Parser::new(input);
loop {
// TODO: these are just for debugging
let rest = parser.rest;
let expecting = parser.expecting;
let event = parser.next();
match event {
Ok(None) => break,
Ok(Some(_)) => {}
Err(err) => {
let rest = std::str::from_utf8(rest).unwrap();
let rest = rest.get(..32).unwrap_or(rest);
dbg!(rest, expecting);
panic!("{err}");
}
let chunks_file = chunks_serde::ChunksFile::new(input).unwrap();
let mut chunks = chunks_file.chunks();
while let Some(mut chunk) = chunks.next_chunk().unwrap() {
while let Some(line) = chunk.next_line().unwrap() {
black_box(line);
}
}
}
Loading
Oops, something went wrong.