Skip to content

Commit

Permalink
Non SIMD - Updates changes from Heinz for similarity
Browse files Browse the repository at this point in the history
The SIMD version changes were suggested here -
simd-lite/simd-json#188 (comment)
  • Loading branch information
amanjeev committed May 12, 2021
1 parent 2349d82 commit e4187c9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ struct SIMDExample<'sin> {

fn main() {
let data_file = File::open("/home/aj/deploy/rust/zcapjson/data/fake_data.json").unwrap();
let reader = BufReader::new(data_file);
let mut reader = BufReader::new(data_file);

for line in reader.lines() {
let row: &mut str = &mut line.unwrap();
let row: SIMDExample = serde_json::from_str(row).unwrap();
match row.id {
2807149942735425369 => println!("look ma! a match! - {}", row.id_str),
_ => println!("No match yet"),
let mut data = Vec::with_capacity(1024);

while reader.read_until(b'\n', &mut data).unwrap() > 0 {
let row: SIMDExample = serde_json::from_slice(data.as_mut_slice()).unwrap();
if row.id == 2807149942735425369 {
println!("look ma! a match! - {}", row.id_str);
}
data.clear();
}
}

0 comments on commit e4187c9

Please sign in to comment.