rust/src/libstd
Ariel Ben-Yehuda 327b9be9e9 Rollup merge of #40561 - arthurprs:hm-adapt2, r=pczarn
Simplify HashMap Bucket interface

> Simplify HashMap Bucket interface
>
> * Store capacity_mask instead of capacity
> * Move bucket index into RawBucket
> * Valid bucket index is now always within [0..table_capacity)
> * Simplify iterators by moving logic into RawBuckets
> * Clone RawTable using RawBucket
> * Make retain aware of the number of elements

The idea was to put idx in RawBucket instead of the other Bucket types and simplify next() and prev() as much as possible. The rest was a side-effect of that change, except maybe the last 2.

This change makes iteration and other next/prev() heavy operations noticeably faster. Clone is way faster.

```
➜  hashmap2 git:(adapt) ✗ cargo benchcmp pre:: adp:: bench.txt
 name                        pre:: ns/iter  adp:: ns/iter  diff ns/iter   diff %
 clone_10_000                74,364         39,736              -34,628  -46.57%
 grow_100_000                8,343,553      8,233,785          -109,768   -1.32%
 grow_10_000                 817,825        723,958             -93,867  -11.48%
 grow_big_value_100_000      18,418,979     17,906,186         -512,793   -2.78%
 grow_big_value_10_000       1,219,242      1,103,334          -115,908   -9.51%
 insert_1000                 74,546         58,343              -16,203  -21.74%
 insert_100_000              6,743,770      6,238,017          -505,753   -7.50%
 insert_10_000               798,079        719,123             -78,956   -9.89%
 insert_1_000_000            275,215,605    266,975,875      -8,239,730   -2.99%
 insert_int_bigvalue_10_000  1,517,387      1,419,838           -97,549   -6.43%
 insert_str_10_000           316,179        278,896             -37,283  -11.79%
 insert_string_10_000        770,927        747,449             -23,478   -3.05%
 iter_keys_100_000           386,099        333,104             -52,995  -13.73%
 iterate_100_000             387,320        355,707             -31,613   -8.16%
 lookup_100_000              206,757        193,063             -13,694   -6.62%
 lookup_100_000_unif         219,366        193,180             -26,186  -11.94%
 lookup_1_000_000            206,456        205,716                -740   -0.36%
 lookup_1_000_000_unif       659,934        629,659             -30,275   -4.59%
 lru_sim                     20,194,334     18,442,149       -1,752,185   -8.68%
 merge_shuffle               1,168,044      1,063,055          -104,989   -8.99%
```

Note 2: I may have messed up porting the diff, let's see what CI says.
2017-04-05 23:01:04 +00:00
..
collections Simplify HashMap Bucket interface 2017-04-04 22:43:27 +02:00
ffi Merge branch 'master' into frewsxcv-osstr 2017-03-16 21:56:52 -04:00
io Rollup merge of #40763 - pirate:patch-2, r=steveklabnik 2017-03-31 16:48:26 -04:00
net Addressed requested changes for PR #40838 2017-03-27 16:38:17 +02:00
os Improve os::linux documentation (#29367) 2017-03-29 23:44:39 +02:00
prelude Remove function invokation parens from documentation links. 2017-03-13 21:43:18 -04:00
rand Update usages of 'OSX' (and other old names) to 'macOS'. 2017-03-12 14:59:04 -04:00
sync Rollup merge of #40981 - Technius:master, r=steveklabnik 2017-04-05 12:44:27 -04:00
sys Revert "Implement AsRawFd/IntoRawFd for RawFd" 2017-04-03 10:17:59 -04:00
sys_common Replace hardcoded forward slash with path::MAIN_SEPARATOR 2017-03-30 13:51:16 +02:00
thread std::thread docs: fix link to current() 2017-04-02 12:03:54 +02:00
time std: Stabilize APIs for the 1.16.0 release 2017-01-25 16:43:01 -08:00
ascii.rs Add more std::ascii module-level docs. 2017-04-01 00:47:58 -07:00
build.rs Automate timestamp creation and build skipping for native libraries 2017-03-04 21:38:26 +03:00
Cargo.toml cleanup: remove the *san Cargo features from std 2017-03-05 14:25:47 -05:00
env.rs clarify docs for Args and ArgsOs 2017-03-05 16:39:26 -05:00
error.rs Implement Error for !. 2017-03-15 23:09:29 -04:00
f32.rs Get linkchecker clean 2017-02-21 14:02:12 -05:00
f64.rs Get linkchecker clean 2017-02-21 14:02:12 -05:00
fs.rs Improve documentation for std::fs::DirBuilder 2017-04-02 04:06:29 +02:00
lib.rs Rollup merge of #40556 - cramertj:stabilize-pub-restricted, r=petrochenkov 2017-03-20 23:44:59 -04:00
macros.rs Get linkchecker clean 2017-02-21 14:02:12 -05:00
memchr.rs std: Move platform specific memchr code into sys 2016-10-01 19:33:02 +00:00
num.rs travis: Get an emscripten builder online 2017-01-19 13:54:19 -08:00
panic.rs std: Relax UnwindSafe impl for Unique 2017-02-21 14:36:24 -08:00
panicking.rs Remove function invokation parens from documentation links. 2017-03-13 21:43:18 -04:00
path.rs Fix a typo in path.rs docs 2017-03-19 07:02:20 +01:00
primitive_docs.rs Rollup merge of #40703 - GuillaumeGomez:pointer-docs, r=steveklabnik 2017-03-31 16:48:24 -04:00
process.rs Update process.rs 2017-03-30 09:55:44 +02:00
rt.rs std: remove a workaround for privacy limitations that isn't necessary anymore 2017-03-13 18:42:23 -07:00