Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (24 sloc) 842 Bytes
// pest. The Elegant Parser
// Copyright (c) 2018 Dragoș Tiselice
//
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. All files in the project carrying such notice may not be copied,
// modified, or distributed except according to those terms.
#![feature(test)]
extern crate pest;
extern crate pest_grammars;
extern crate test;
use std::fs::File;
use std::io::Read;
use test::Bencher;
use pest::Parser;
use pest_grammars::json::*;
#[bench]
fn data(b: &mut Bencher) {
let mut file = File::open("benches/data.json").unwrap();
let mut data = String::new();
file.read_to_string(&mut data).unwrap();
b.iter(|| JsonParser::parse(Rule::json, &data).unwrap());
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.