Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the amount of llvm IR instantiated #205

Merged
merged 33 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
873985a
chore: Add a benchmark for growing a map while inserting to it
Sep 29, 2020
022f06e
refactor: Extract a non generic part of RawTable
Sep 29, 2020
22558c1
perf(compile): Extract part of rehash_in_place
Sep 29, 2020
3fb20c4
perf(compile): find_insert_slot does not depend on T
Sep 29, 2020
4de4929
perf(compile): Extract more parts out of rehash_in_place
Sep 29, 2020
be9ce39
perf(compile): Move part of fallible_with_capacity out
Sep 29, 2020
5204be0
perf(compile): Make calculate_layout non-generic
Sep 29, 2020
82a6dad
perf(compiler): Make the panic guard non-generic on rehash
Sep 29, 2020
57179c8
perf(compile): Make raw_iter_hash less generic
Sep 29, 2020
f64f332
perf(compile): Make resize less generic
Sep 29, 2020
933251a
perf(compiler): Make RawIterRange less generic
Sep 29, 2020
cccbead
clear_no_drop does not need to be generic
Sep 29, 2020
030bf08
refactor: Merge the drop loop into a function
Sep 29, 2020
e7a9bd4
perf(compile): Make the resize panic guard less generic
Sep 29, 2020
aa7c1be
perf(compiler): Shrink rehash_in_place a bit more
Sep 29, 2020
3eac162
perf(compile): Make erase less generic
Sep 29, 2020
5df48f6
cleanup
Sep 29, 2020
c83bf9d
Restore performance of the RawIterRange
Oct 2, 2020
c205120
Fix performance on raw_iter_hash
Oct 2, 2020
8a229a5
chore: Ensure the raw feature is compiled on CI
Oct 5, 2020
8721c34
Revert the iteration to be generic again
Oct 5, 2020
4b3932f
perf(compile): Make rehash_in_place smaller
Oct 6, 2020
34bab11
fix rayon feature
Oct 6, 2020
ba25130
perf: Avoid some re-hashing in rehash_in_place
Oct 6, 2020
52e63ee
perf(compile): Parameterize by Layout instead of T
Oct 6, 2020
f919e17
perf(compile): Shrink resize
Oct 6, 2020
179a942
perf(compile): Move h2 calls into a dedicated set_ctrl_h2 function
Oct 6, 2020
e04c18d
refactor: Merge set_ctrl_h2 into find_insert_slot when possible
Oct 6, 2020
93ba7fe
Finish up into something that does not regress performance
Oct 6, 2020
6a52d22
refactor: Remove calcualuate_layout for the nightly feature
Marwes Jan 24, 2021
425fe48
Add inline on prepare_rehash_in_place
Marwes Jan 24, 2021
cae5a3a
Explain the fn argument
Marwes Jan 24, 2021
99a7e3e
Try specializing the drop in rehash_in_place again
Jan 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ macro_rules! bench_insert {
b.iter(|| {
m.clear();
for i in ($keydist).take(SIZE) {
m.insert(i, DropType(i));
m.insert(i, (DropType(i), [i; 20]));
}
black_box(&mut m);
});
Expand All @@ -105,6 +105,31 @@ bench_suite!(
insert_std_random
);

macro_rules! bench_grow_insert {
($name:ident, $maptype:ident, $keydist:expr) => {
#[bench]
fn $name(b: &mut Bencher) {
b.iter(|| {
let mut m = $maptype::default();
for i in ($keydist).take(SIZE) {
m.insert(i, DropType(i));
}
black_box(&mut m);
})
}
};
}

bench_suite!(
bench_grow_insert,
grow_insert_ahash_serial,
grow_insert_std_serial,
grow_insert_ahash_highbits,
grow_insert_std_highbits,
grow_insert_ahash_random,
grow_insert_std_random
);

macro_rules! bench_insert_erase {
($name:ident, $maptype:ident, $keydist:expr) => {
#[bench]
Expand Down
2 changes: 1 addition & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ "${NO_STD}" = "1" ]; then
FEATURES="rustc-internal-api"
OP="build"
else
FEATURES="rustc-internal-api,serde,rayon"
FEATURES="rustc-internal-api,serde,rayon,raw"
OP="test"
fi
if [ "${TRAVIS_RUST_VERSION}" = "nightly" ]; then
Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ pub mod raw {
pub use inner::*;

#[cfg(feature = "rayon")]
/// [rayon]-based parallel iterator types for hash maps.
/// You will rarely need to interact with it directly unless you have need
/// to name one of the iterator types.
///
/// [rayon]: https://docs.rs/rayon/1.0/rayon
pub mod rayon {
pub use crate::external_trait_impls::rayon::raw::*;
}
Expand Down
Loading