Created
June 1, 2017 00:12
-
-
Save xrl/042e2e5e343ea27fe535a2146b62efee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[bench] | |
fn parse_file(b: &mut Bencher) { | |
use std::fs::{ File }; | |
use std::io::{ Seek, SeekFrom }; | |
let mut f = File::open("/Users/xlange/30ece7c43b7c302f43e54ac9f299ca36efb8184375eac0563c9340a15100ee3c-json.log").unwrap(); | |
b.iter(|| { | |
{ | |
use std::io::{BufRead, BufReader}; | |
let buf_f = BufReader::new(&f); | |
for sample in buf_f.lines() { | |
let line = sample.unwrap(); | |
let _: DockerLogLine = serde_json::from_str(&line[..]).unwrap(); | |
} | |
} | |
f.seek(SeekFrom::Start(0)).unwrap(); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment