v0.6.0 ns/iter master ns/iter diff ns/iter diff %
bench_selecting_0_rows_with_medium_complex_query 223,674 119,463 -104,211 -46.59%
bench_selecting_0_rows_with_trivial_query 77,281 51,273 -26,008 -33.65%
bench_selecting_10k_rows_with_medium_complex_query 57,555,386 55,233,745 -2,321,641 -4.03%
bench_selecting_10k_rows_with_medium_complex_query_boxed 58,937,340 54,434,717 -4,502,623 -7.64%
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mutable state | |
let mut sql_type = None; | |
let mut sql_type_ref = None; | |
if !type_args.is_empty() { | |
sql_type = Some(quote!((#(#type_args),*))); | |
sql_type_ref = Some(quote!((#(&'a #type_args),*))); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is what it looks like in Diesel 1.0. | |
// This is a "bare minimum" set of impls, which do not result in a type that can be used everywhere | |
// a built in one can. There are 7 variants of `AsExpression` and an additional `ToSql` impl | |
// that a type needs to be used absolutely everywhere. | |
pub struct MyType; | |
#[derive(Debug, PartialEq)] | |
pub enum MyEnum { | |
Foo, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the structure of the code #[derive(Queryable)] | |
// generates in diesel_derives. It's tricky, because we can't assume | |
// that you did `extern crate diesel;` or that anything named `diesel` | |
// is in scope. In a normal macro you have `$crate` for this, but | |
// custom derives don't have access to that so we have to do hacks to make this work. | |
const _IMPL_QUERYABLE_FOR_FOO: () { | |
// This is kinda like if we had access to $crate | |
// but this doesn't work if we try to use this code within diesel itself | |
extern crate diesel; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(dead_code)] | |
extern crate ansi_term; | |
mod engines; | |
mod fuels; | |
use std::fmt; | |
use std::marker::PhantomData; | |
use ansi_term::Colour::{Red, Yellow, Blue}; | |
use self::engines::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test bench_simple_query_10_000_rows_diesel ... bench: 4,466,833 ns/iter (+/- 307,208) | |
test bench_simple_query_10_000_rows_postgres ... bench: 5,869,441 ns/iter (+/- 624,448) | |
test bench_simple_query__1_000_rows_diesel ... bench: 573,806 ns/iter (+/- 193,485) | |
test bench_simple_query__1_000_rows_postgres ... bench: 785,102 ns/iter (+/- 129,559) | |
test bench_simple_query____100_rows_diesel ... bench: 178,726 ns/iter (+/- 65,002) | |
test bench_simple_query____100_rows_postgres ... bench: 178,018 ns/iter (+/- 44,015) | |
test bench_simple_query_____10_rows_diesel ... bench: 109,076 ns/iter (+/- 45,967) | |
test bench_simple_query_____10_rows_postgres ... bench: 110,680 ns/iter (+/- 28,012) | |
test bench_simple_query______0_rows_diesel ... bench: 90,363 ns/iter (+/- 10,466) | |
test bench_simple_query______0_rows_postgres ... bench: 147,805 ns/iter (+/- 64,702) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt; | |
use std::marker::PhantomData; | |
fn main() { | |
// Upper stages | |
let ablestar = SimpleStage { dry_mass: 667.0, engine: AJ10_104D, }; | |
let baby_sergeant_1 = SimpleStage { dry_mass: BABY_SERGEANT.mass, engine: BABY_SERGEANT }; | |
let baby_sergeant_3 = MultiEngine { dry_mass: BABY_SERGEANT.mass * 3.0, engine: BABY_SERGEANT, engine_count: 3 }; | |
let baby_sergeant_11 = MultiEngine { dry_mass: BABY_SERGEANT.mass * 11.0, engine: BABY_SERGEANT, engine_count: 11 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cache.entry(sql).or_insert_with_result(|sql| { | |
Statement::prepare(&self.raw_connection, &sql) | |
.map(CachedStatement::new) | |
}).clone() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/diesel/src/lib.rs b/diesel/src/lib.rs | |
index 28c60a3..18225b2 100644 | |
--- a/diesel/src/lib.rs | |
+++ b/diesel/src/lib.rs | |
@@ -3,6 +3,7 @@ | |
//! found in the README. | |
#![deny(warnings)] | |
#![cfg_attr(feature = "unstable", feature(specialization))] | |
+#![cfg_attr(all(test, feature = "unstable"), feature(test))] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match cache.entry(sql) { | |
Occupied(entry) => Ok(entry.get().clone()), | |
Vacant(entry) => { | |
let statement = try!(Statement::prepare(&self.raw_connection, entry.key())); | |
Ok(entry.insert(CachedStatement::new(statement)).clone()) | |
} | |
} |
NewerOlder