Compare commits
9 commits
master
...
benchmarks
Author | SHA1 | Date | |
---|---|---|---|
|
53e8cb1197 | ||
|
a6d5dd0acf | ||
|
c8d4da6960 | ||
|
930cfcc8a6 | ||
|
e877b0dd7e | ||
|
c450f9b5b8 | ||
|
026af0b213 | ||
|
3cc99d7527 | ||
|
3cbc191553 |
2 changed files with 64 additions and 1 deletions
10
.travis.yml
10
.travis.yml
|
@ -1,3 +1,11 @@
|
|||
language: rust
|
||||
rust:
|
||||
- stable
|
||||
- nightly-2017-04-11 # workaround until https://github.com/rust-lang-nursery/rustup.rs/issues/1062 is resolved
|
||||
script:
|
||||
- cargo test --verbose --all
|
||||
- cargo build
|
||||
- cargo test --all
|
||||
after_success:
|
||||
- if [ "$TRAVIS_RUST_VERSION" == "nightly-2017-04-11" ]; then
|
||||
cargo bench --package mentat_tx_parser;
|
||||
fi
|
55
tx-parser/benches/bench.rs
Normal file
55
tx-parser/benches/bench.rs
Normal file
|
@ -0,0 +1,55 @@
|
|||
#![feature(test)]
|
||||
|
||||
// These benchmarks can be run from the project root with:
|
||||
// > cargo bench --package mentat_tx_parser
|
||||
|
||||
extern crate test;
|
||||
extern crate edn;
|
||||
extern crate mentat_tx_parser;
|
||||
|
||||
use test::Bencher;
|
||||
use mentat_tx_parser::Tx;
|
||||
|
||||
#[bench]
|
||||
fn bench_parse1(b: &mut Bencher) {
|
||||
let input = r#"[[:db/add 1 :test/val "a"]]"#;
|
||||
let parsed_edn = edn::parse::value(input).expect("to parse test input");
|
||||
b.iter(|| {
|
||||
return Tx::parse(parsed_edn.clone());
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_parse2(b: &mut Bencher) {
|
||||
let input = r#"
|
||||
[[:db/add 1 :test/val "a"]
|
||||
[:db/add 2 :test/val "b"]
|
||||
[:db/add 3 :test/val "c"]
|
||||
[:db/add 4 :test/val "d"]
|
||||
[:db/add 5 :test/val "e"]
|
||||
[:db/add 6 :test/val "f"]
|
||||
[:db/add 7 :test/val "g"]
|
||||
[:db/add 8 :test/val "h"]
|
||||
[:db/add 9 :test/val "i"]
|
||||
[:db/add 10 :test/val "j"]
|
||||
[:db/add 11 :test/val "k"]
|
||||
[:db/add 12 :test/val "l"]
|
||||
[:db/add 13 :test/val "m"]
|
||||
[:db/add 14 :test/val "n"]
|
||||
[:db/add 15 :test/val "o"]
|
||||
[:db/add 16 :test/val "p"]
|
||||
[:db/add 17 :test/val "q"]
|
||||
[:db/add 18 :test/val "r"]
|
||||
[:db/add 19 :test/val "s"]
|
||||
[:db/add 20 :test/val "t"]
|
||||
[:db/add 21 :test/val "u"]
|
||||
[:db/add 22 :test/val "v"]
|
||||
[:db/add 23 :test/val "w"]
|
||||
[:db/add 24 :test/val "x"]
|
||||
[:db/add 25 :test/val "y"]
|
||||
[:db/add 26 :test/val "z"]]"#;
|
||||
let parsed_edn = edn::parse::value(input).expect("to parse test input");
|
||||
b.iter(|| {
|
||||
return Tx::parse(parsed_edn.clone());
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue