RPM build fix (reverted CI changes which will need to be un-reverted or made conditional) and vendor Rust dependencies to make builds much faster in any CI system.
This commit is contained in:
40
zeroidc/vendor/http/benches/method.rs
vendored
Normal file
40
zeroidc/vendor/http/benches/method.rs
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
#![feature(test)]
|
||||
|
||||
extern crate test;
|
||||
|
||||
use http::method::Method;
|
||||
use test::Bencher;
|
||||
|
||||
fn make_all_methods() -> Vec<Vec<u8>> {
|
||||
vec![
|
||||
b"OPTIONS".to_vec(),
|
||||
b"GET".to_vec(),
|
||||
b"POST".to_vec(),
|
||||
b"PUT".to_vec(),
|
||||
b"DELETE".to_vec(),
|
||||
b"HEAD".to_vec(),
|
||||
b"TRACE".to_vec(),
|
||||
b"CONNECT".to_vec(),
|
||||
b"PATCH".to_vec(),
|
||||
b"CUSTOM_SHORT".to_vec(),
|
||||
b"CUSTOM_LONG_METHOD".to_vec(),
|
||||
]
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn method_easy(b: &mut Bencher) {
|
||||
let name = b"GET";
|
||||
b.iter(|| {
|
||||
Method::from_bytes(&name[..]).unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn method_various(b: &mut Bencher) {
|
||||
let all_methods = make_all_methods();
|
||||
b.iter(|| {
|
||||
for name in &all_methods {
|
||||
Method::from_bytes(name.as_slice()).unwrap();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user