I don't know why the benchmarks keep cycling.
This commit is contained in:
parent
1031315cdd
commit
e63a366fdc
@ -1,24 +1,16 @@
|
|||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
|
|
||||||
extern crate futures;
|
|
||||||
extern crate hammond_data;
|
extern crate hammond_data;
|
||||||
extern crate hyper;
|
extern crate hyper;
|
||||||
extern crate hyper_tls;
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
extern crate rayon;
|
// extern crate rayon;
|
||||||
extern crate rss;
|
extern crate rss;
|
||||||
extern crate test;
|
extern crate test;
|
||||||
extern crate tokio_core;
|
|
||||||
|
|
||||||
// use rayon::prelude::*;
|
// use rayon::prelude::*;
|
||||||
|
|
||||||
use test::Bencher;
|
use test::Bencher;
|
||||||
|
|
||||||
use tokio_core::reactor::Core;
|
|
||||||
use hyper::Client;
|
|
||||||
use hyper_tls::HttpsConnector;
|
|
||||||
use futures::future::*;
|
|
||||||
|
|
||||||
use hammond_data::Source;
|
use hammond_data::Source;
|
||||||
use hammond_data::feed::*;
|
use hammond_data::feed::*;
|
||||||
use hammond_data::database::truncate_db;
|
use hammond_data::database::truncate_db;
|
||||||
@ -41,6 +33,7 @@ static URLS: &[(&[u8], &str)] = &[
|
|||||||
];
|
];
|
||||||
|
|
||||||
static URLS2: &[&str] = &[
|
static URLS2: &[&str] = &[
|
||||||
|
"https://www.pcper.com/rss/podcasts-mp3.rss",
|
||||||
"https://feeds.feedburner.com/InterceptedWithJeremyScahill",
|
"https://feeds.feedburner.com/InterceptedWithJeremyScahill",
|
||||||
"http://www.badvoltage.org/feed/ogg/",
|
"http://www.badvoltage.org/feed/ogg/",
|
||||||
"https://www.theguardian.com/news/series/the-audio-long-read/podcast.xml",
|
"https://www.theguardian.com/news/series/the-audio-long-read/podcast.xml",
|
||||||
@ -95,36 +88,27 @@ fn bench_index_unchanged_feeds(b: &mut Bencher) {
|
|||||||
fn bench_get_normal_feeds(b: &mut Bencher) {
|
fn bench_get_normal_feeds(b: &mut Bencher) {
|
||||||
// Index first so it will only bench the comparison test case.
|
// Index first so it will only bench the comparison test case.
|
||||||
truncate_db().unwrap();
|
truncate_db().unwrap();
|
||||||
|
URLS2.iter().for_each(|url| {
|
||||||
|
Source::from_url(url).unwrap();
|
||||||
|
});
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
URLS2.iter().for_each(|url| {
|
let sources = hammond_data::dbqueries::get_sources().unwrap();
|
||||||
let mut s = Source::from_url(url).unwrap();
|
index_loop(sources);
|
||||||
let _feed = s.into_feed(true);
|
println!("I RUN");
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_get_future_feeds(b: &mut Bencher) {
|
fn bench_get_future_feeds(b: &mut Bencher) {
|
||||||
truncate_db().unwrap();
|
truncate_db().unwrap();
|
||||||
|
|
||||||
b.iter(|| {
|
|
||||||
let mut core = Core::new().unwrap();
|
|
||||||
let handle = core.handle();
|
|
||||||
let client = Client::configure()
|
|
||||||
.connector(HttpsConnector::new(4, &handle).unwrap())
|
|
||||||
.build(&handle);
|
|
||||||
|
|
||||||
let mut foo = vec![];
|
|
||||||
|
|
||||||
URLS2.iter().for_each(|url| {
|
URLS2.iter().for_each(|url| {
|
||||||
let s = Source::from_url(url).unwrap();
|
Source::from_url(url).unwrap();
|
||||||
let future = s.into_fututre_feed(&client, true);
|
|
||||||
foo.push(future);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let work = join_all(foo);
|
b.iter(|| {
|
||||||
let res = core.run(work);
|
let sources = hammond_data::dbqueries::get_sources().unwrap();
|
||||||
assert!(res.is_ok());
|
hammond_data::pipeline::pipeline(sources).unwrap();
|
||||||
|
println!("I RUN");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user