about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-20 05:19:40 -0700
committerbors <bors@rust-lang.org>2013-05-20 05:19:40 -0700
commitf323b0c8bac704366eb307437faea231fb73b8d1 (patch)
tree86c6116c5bb82a6fdb9fbfd347f29f73af1f95c3
parent2e6cda254a2acdcd60efb62a27f69c7702b8f71e (diff)
parent09efd472a9ed60be6daa62d9339b0c5e6db92ee4 (diff)
downloadrust-f323b0c8bac704366eb307437faea231fb73b8d1.tar.gz
rust-f323b0c8bac704366eb307437faea231fb73b8d1.zip
auto merge of #6640 : dotdash/rust/hash_perf, r=bstrie
The function was a workaround for bootstrapping that isn't required
anymore and just degrades hashmap performance, as it doesn't get inlined
cross-crate and turns a no-op into a call.
-rw-r--r--src/libcore/hash.rs34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/libcore/hash.rs b/src/libcore/hash.rs
index d116c966c5c..69312f3a97b 100644
--- a/src/libcore/hash.rs
+++ b/src/libcore/hash.rs
@@ -76,16 +76,12 @@ pub trait Streaming {
     fn reset(&mut self);
 }
 
-fn transmute_for_stage0<'a>(bytes: &'a [u8]) -> &'a [u8] {
-    bytes
-}
-
 impl<A:IterBytes> Hash for A {
     #[inline(always)]
     fn hash_keyed(&self, k0: u64, k1: u64) -> u64 {
         let mut s = State::new(k0, k1);
         for self.iter_bytes(true) |bytes| {
-            s.input(transmute_for_stage0(bytes));
+            s.input(bytes);
         }
         s.result_u64()
     }
@@ -95,10 +91,10 @@ fn hash_keyed_2<A: IterBytes,
                 B: IterBytes>(a: &A, b: &B, k0: u64, k1: u64) -> u64 {
     let mut s = State::new(k0, k1);
     for a.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for b.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     s.result_u64()
 }
@@ -108,13 +104,13 @@ fn hash_keyed_3<A: IterBytes,
                 C: IterBytes>(a: &A, b: &B, c: &C, k0: u64, k1: u64) -> u64 {
     let mut s = State::new(k0, k1);
     for a.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for b.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for c.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     s.result_u64()
 }
@@ -132,16 +128,16 @@ fn hash_keyed_4<A: IterBytes,
                 -> u64 {
     let mut s = State::new(k0, k1);
     for a.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for b.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for c.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for d.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     s.result_u64()
 }
@@ -161,19 +157,19 @@ fn hash_keyed_5<A: IterBytes,
                 -> u64 {
     let mut s = State::new(k0, k1);
     for a.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for b.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for c.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for d.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     for e.iter_bytes(true) |bytes| {
-        s.input(transmute_for_stage0(bytes));
+        s.input(bytes);
     }
     s.result_u64()
 }