Compare commits

...

9 commits

Author SHA1 Message Date
Brian Grinstead
53e8cb1197 Get rid of verbosity for test 2017-04-13 13:28:32 -07:00
Brian Grinstead
a6d5dd0acf Use workaround 2017-04-13 13:25:12 -07:00
Brian Grinstead
c8d4da6960 add semicolon 2017-04-13 13:20:32 -07:00
Brian Grinstead
930cfcc8a6 Test without verbosity on build 2017-04-13 13:17:36 -07:00
Brian Grinstead
e877b0dd7e update to fix bug with nightly 2017-04-13 13:13:40 -07:00
Brian Grinstead
c450f9b5b8 include build in script 2017-04-13 13:11:58 -07:00
Brian Grinstead
026af0b213 try nightly only 2017-04-13 12:00:19 -07:00
Brian Grinstead
3cc99d7527 test out travis integration with cargo bench 2017-04-13 11:56:16 -07:00
Brian Grinstead
3cbc191553 Add an initial benchmark for the tx-parser crate. (#406) r=nalexander 2017-04-13 10:31:38 -07:00
2 changed files with 64 additions and 1 deletions

View file

@ -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

View 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());
});
}