From c463767923a68bd4cd1b6b785c70edcd21a757d9 Mon Sep 17 00:00:00 2001 From: Lloyd Date: Sun, 23 Apr 2017 20:25:18 +0900 Subject: [PATCH 1/2] Add inline always to sculpt to make it LabelledGeneric::transform_from a zero-cost extraction --- benches/labelled.rs | 30 +++++++++++++++--------------- core/src/hlist.rs | 2 ++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/benches/labelled.rs b/benches/labelled.rs index 244eff270..f0715416c 100644 --- a/benches/labelled.rs +++ b/benches/labelled.rs @@ -309,21 +309,21 @@ fn big_from_24fields(b: &mut Bencher) { // Hilariously, uncommenting this out will kill the performance in the above 2 benchmarks -//#[bench] -//fn big_transform_from_25fields(b: &mut Bencher) { -// b.iter(|| { -// let j = BigStruct25FieldsReverse::transform_from(build_big_struct_25fields()); -// j -// }) -//} -// -//#[bench] -//fn big_from_25fields(b: &mut Bencher) { -// b.iter(|| { -// let j = >::from(build_big_struct_25fields()); -// j -// }) -//} +#[bench] +fn big_transform_from_25fields(b: &mut Bencher) { + b.iter(|| { + let j = BigStruct25FieldsReverse::transform_from(build_big_struct_25fields()); + j + }) +} + +#[bench] +fn big_from_25fields(b: &mut Bencher) { + b.iter(|| { + let j = >::from(build_big_struct_25fields()); + j + }) +} diff --git a/core/src/hlist.rs b/core/src/hlist.rs index 94b076f1e..70bd5ebc5 100644 --- a/core/src/hlist.rs +++ b/core/src/hlist.rs @@ -435,6 +435,7 @@ pub trait Sculptor { impl Sculptor for Source { type Remainder = Source; + #[inline(always)] fn sculpt(self) -> (HNil, Self::Remainder) { (HNil, self) } @@ -453,6 +454,7 @@ for HCons { type Remainder = < as Plucker>::Remainder as Sculptor>::Remainder; + #[inline(always)] fn sculpt(self) -> (HCons, Self::Remainder) { let (p, r): (THead, as Plucker>::Remainder) = self.pluck(); From cafabca6bab35c278e51f3258c27ae8f6b76815b Mon Sep 17 00:00:00 2001 From: Lloyd Date: Sun, 23 Apr 2017 21:18:44 +0900 Subject: [PATCH 2/2] Try setting nightly date --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a907d3dcd..35fc26dfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: false rust: - stable - - nightly + - nightly-2017-04-21 cache: cargo