about summary refs log tree commit diff
path: root/src/librustc_data_structures
AgeCommit message (Collapse)AuthorLines
2018-08-27Auto merge of #53656 - nnethercote:HybridIdxSet-tweaks, r=nikomatsakisbors-74/+100
`HybridIdxSet` tweaks A couple of tweaks to `HybridIdxSet`. r? @nikomatsakis
2018-08-26Auto merge of #53629 - nnethercote:lazier-SparseBitMatrix, r=nikomatsakisbors-34/+38
Lazier sparse bit matrix A small NLL win. r? @nikomatsakis
2018-08-24check that adding infer-outlives requirement to all crates worksNiko Matsakis-0/+1
2018-08-24Introduce `UnionIntoIdxSet` and `SubtractFromIdxSet` traits.Nicholas Nethercote-38/+68
They let `union()`, `union_sparse()` and `union_hybrid()` be merged. Likewise for subtract()`, `subtract_sparse()` and `subtract_hybrid()`.
2018-08-24Rename `universe_size` as `domain_size`.Nicholas Nethercote-36/+32
Because `domain` is a more obvious term than `universe` for this concept.
2018-08-23Use SmallVec for SmallCStrAndre Bogus-48/+39
2018-08-23Make SparseBitMatrix a bit lazier.Nicholas Nethercote-28/+32
Currently when a row is instantiated in SparseBitMatrix, any missing rows prior to it are also fully instantiated. This patch changes things so that those prior rows are minimally instantiated (with a `None`). This avoids a decent number of allocations in NLL, speeding up several benchmarks by up to 0.5%. The patch also removes two unused methods, `len()` and `iter_enumerated()`.
2018-08-23Use optimized SmallVec implementationIgor Gutorov-355/+12
2018-08-23Rename the fields in `SparseBitMatrix`.Nicholas Nethercote-19/+19
The new names are clearer.
2018-08-23Auto merge of #53520 - nnethercote:merge-IdxSet-IdxSetBuf, r=nikomatsakisbors-150/+64
Merge `IdxSet` and `IdxSetBuf` Because it simplifies things. @r? nikomatsakis
2018-08-21Rollup merge of #53329 - frewsxcv:frewsxcv-ptr-add-sub, r=RalfJungkennytm-4/+4
Replace usages of ptr::offset with ptr::{add,sub}. Rust provides these helper methods – so let's use them!
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-2/+2
Fix typos found by codespell.
2018-08-20Replace usages of ptr::offset with ptr::{add,sub}.Corey Farwell-4/+4
2018-08-20Remove IdxSet typedef and Rename {,Hybrid}IdxSetBuf as {,Hybrid}IdxSet.Nicholas Nethercote-66/+63
Now that the `Buf` vs. non-`Buf` distinction has been removed, it makes sense to drop the `Buf` suffix and use the shorter names everywhere.
2018-08-20Merge `IdxSet` and `IdxSetBuf`.Nicholas Nethercote-88/+5
The `Buf` vs. non-`Buf` distinction is no longer necessary, and the nastiest code in this file can be removed. To minimize this patch, `IdxSet` is made a typedef of `IdxSetBuf`. The next patch will remove this typedef.
2018-08-19Stabilize macro_vis_matcherJakub Kozlowski-1/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-2/+2
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-4/+4
2018-08-17Auto merge of #53383 - nnethercote:HybridIdxSetBuf, r=nikomatsakisbors-10/+237
Speed up NLL with HybridIdxSetBuf. It's a sparse-when-small but dense-when-large index set that is very efficient for sets that (a) have few elements, (b) have large universe_size values, and (c) are cleared frequently. Which makes it perfect for the `gen_set` and `kill_set` sets used by the new borrow checker. This patch reduces `tuple-stress`'s NLL-check time by 40%, and up to 12% for several other benchmarks. And it halves the max-rss for `keccak`, and has smaller wins for `inflate` and `clap-rs`.
2018-08-16Speed up NLL with `HybridIdxSetBuf`.Nicholas Nethercote-10/+237
`HybridIdxSetBuf` is a sparse-when-small but dense-when-large index set that is very efficient for sets that (a) have few elements, (b) have large `universe_size` values, and (c) are cleared frequently. Which makes it perfect for the `gen_set` and `kill_set` sets used by the new borrow checker. This patch reduces the execution time of the five slowest NLL benchmarks by 55%, 21%, 16%, 10% and 9%. It also reduces the max-rss of three benchmarks by 53%, 33%, and 9%.
2018-08-15Rollup merge of #53271 - llogiq:simplify-maybe-map, r=joshtriplettGuillaume Gomez-6/+1
use ? to simplify `TransitiveRelation.maybe_map` I think this looks much clearer than the original.
2018-08-13use ? to simplify `TransitiveRelation.maybe_map`Andre Bogus-6/+1
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-0/+125
2018-08-13Auto merge of #53161 - michaelwoerister:cstrings, r=wesleywiserbors-0/+175
Avoid many allocations for CStrings during codegen. Giving in to my irrational fear of dynamic allocations. Let's see what perf says to this.
2018-08-12Rollup merge of #53230 - memoryruins:nll_bootstrap_4, r=nikomatsakisGuillaume Gomez-1/+2
[nll] enable feature(nll) on various crates for bootstrap: part 4 #53172 r? @nikomatsakis
2018-08-12Rollup merge of #53223 - ljedrz:cleanup_data_structures, r=oli-obkGuillaume Gomez-39/+38
A few cleanups for rustc_data_structures - remove a redundant `clone()` - make some calls to `.iter()` implicit - collapse/simplify a few operations - remove some explicit `return`s - make `SnapshotMap::{commit, rollback_to}` take references - remove unnecessary struct field names - change `transmute()`s in `IdxSet::{from_slice, from_slice_mut}` to casts - remove some unnecessary lifetime annotations - split 2 long literals
2018-08-12Rollup merge of #53019 - ljedrz:bad_collects, r=estebankGuillaume Gomez-1/+6
Don't collect() when size_hint is useless This adjusts PRs #52738 and #52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity. It is a performance win.
2018-08-10Introduce SmallCStr and use it where applicable.Michael Woerister-0/+132
2018-08-10Introduce const_cstr!() macro and use it where applicable.Michael Woerister-0/+43
2018-08-09[nll] librustc_data_structures: remove unused mut annotation in testmemoryruins-1/+1
2018-08-09A few cleanups for rustc_data_structuresljedrz-24/+27
2018-08-09Change transmute()s in IdxSet::{from_slice, from_slice_mut} to castsljedrz-6/+2
2018-08-09Make SnapshotMap::{commit, rollback_to} take referencesljedrz-9/+9
2018-08-09Move Fingerprint to data structuresMark Rousskov-1/+113
2018-08-09Reuse Hash impls for session data structuresMark Rousskov-4/+7
2018-08-09Move SVH structure to data structuresMark Rousskov-0/+86
2018-08-09[nll] librustc_data_structures: enable feature(nll) for bootstrapmemoryruins-0/+1
2018-08-06Auto merge of #52644 - varkor:lib-feature-gate-2, r=withoutboatsbors-1/+0
Add errors for unknown, stable and duplicate feature attributes - Adds an error for unknown (lang and lib) features. - Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features). - Adds an error for duplicate (lang and lib) features. ```rust #![feature(fake_feature)] //~ ERROR unknown feature `fake_feature` #![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0 #![feature(non_exhaustive)] #![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute ``` Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features). There are a few outstanding problems, that I haven't narrowed down yet: - [x] Stability attributes on macros do not seem to be taken into account. - [x] Stability attributes behind `cfg` attributes are not taken into account. - [x] There are failing incremental tests.
2018-08-05Remove unnecessary feature attributes that sneaked invarkor-1/+0
2018-08-03Don't collect() when size_hint is uselessljedrz-1/+6
2018-08-02make TinyList more readable and optimize remove(_)Andre Bogus-32/+49
also add benchmarks Before: ``` test tiny_list::test::bench_insert_empty ... bench: 1 ns/iter (+/- 0) test tiny_list::test::bench_insert_one ... bench: 16 ns/iter (+/- 0) test tiny_list::test::bench_remove_empty ... bench: 2 ns/iter (+/- 0) test tiny_list::test::bench_remove_one ... bench: 6 ns/iter (+/- 0) test tiny_list::test::bench_remove_unknown ... bench: 4 ns/iter (+/- 0) ``` After: ``` test tiny_list::test::bench_insert_empty ... bench: 1 ns/iter (+/- 0) test tiny_list::test::bench_insert_one ... bench: 16 ns/iter (+/- 0) test tiny_list::test::bench_remove_empty ... bench: 0 ns/iter (+/- 0) test tiny_list::test::bench_remove_one ... bench: 3 ns/iter (+/- 0) test tiny_list::test::bench_remove_unknown ... bench: 2 ns/iter (+/- 0) ```
2018-08-01Rollup merge of #52942 - llogiq:smallvec-opt, r=Mark-SimulacrumPietro Albini-12/+5
Another SmallVec.extend optimization This improves SmallVec.extend even more over #52859 while making the code easier to read. Before ``` test small_vec::tests::fill_small_vec_1_10_with_cap ... bench: 31 ns/iter (+/- 5) test small_vec::tests::fill_small_vec_1_10_wo_cap ... bench: 70 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_1_50_with_cap ... bench: 36 ns/iter (+/- 3) test small_vec::tests::fill_small_vec_1_50_wo_cap ... bench: 256 ns/iter (+/- 17) test small_vec::tests::fill_small_vec_32_10_with_cap ... bench: 31 ns/iter (+/- 5) test small_vec::tests::fill_small_vec_32_10_wo_cap ... bench: 26 ns/iter (+/- 1) test small_vec::tests::fill_small_vec_32_50_with_cap ... bench: 49 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_32_50_wo_cap ... bench: 219 ns/iter (+/- 11) test small_vec::tests::fill_small_vec_8_10_with_cap ... bench: 32 ns/iter (+/- 2) test small_vec::tests::fill_small_vec_8_10_wo_cap ... bench: 61 ns/iter (+/- 12) test small_vec::tests::fill_small_vec_8_50_with_cap ... bench: 37 ns/iter (+/- 3) test small_vec::tests::fill_small_vec_8_50_wo_cap ... bench: 210 ns/iter (+/- 10) ``` After: ``` test small_vec::tests::fill_small_vec_1_10_wo_cap ... bench: 31 ns/iter (+/- 3) test small_vec::tests::fill_small_vec_1_50_with_cap ... bench: 39 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_1_50_wo_cap ... bench: 35 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_32_10_with_cap ... bench: 37 ns/iter (+/- 3) test small_vec::tests::fill_small_vec_32_10_wo_cap ... bench: 32 ns/iter (+/- 2) test small_vec::tests::fill_small_vec_32_50_with_cap ... bench: 52 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_32_50_wo_cap ... bench: 46 ns/iter (+/- 0) test small_vec::tests::fill_small_vec_8_10_with_cap ... bench: 35 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_8_10_wo_cap ... bench: 31 ns/iter (+/- 0) test small_vec::tests::fill_small_vec_8_50_with_cap ... bench: 40 ns/iter (+/- 15) test small_vec::tests::fill_small_vec_8_50_wo_cap ... bench: 36 ns/iter (+/- 2) ```
2018-08-01Split out growth functionality into BitVector typeMark Rousskov-59/+77
2018-08-01Another SmallVec.extend optimizationAndre Bogus-12/+5
This improves SmallVec.extend even more over #52859 Before (as of #52859): ``` test small_vec::tests::fill_small_vec_1_10_with_cap ... bench: 31 ns/iter (+/- 5) test small_vec::tests::fill_small_vec_1_10_wo_cap ... bench: 70 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_1_50_with_cap ... bench: 36 ns/iter (+/- 3) test small_vec::tests::fill_small_vec_1_50_wo_cap ... bench: 256 ns/iter (+/- 17) test small_vec::tests::fill_small_vec_32_10_with_cap ... bench: 31 ns/iter (+/- 5) test small_vec::tests::fill_small_vec_32_10_wo_cap ... bench: 26 ns/iter (+/- 1) test small_vec::tests::fill_small_vec_32_50_with_cap ... bench: 49 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_32_50_wo_cap ... bench: 219 ns/iter (+/- 11) test small_vec::tests::fill_small_vec_8_10_with_cap ... bench: 32 ns/iter (+/- 2) test small_vec::tests::fill_small_vec_8_10_wo_cap ... bench: 61 ns/iter (+/- 12) test small_vec::tests::fill_small_vec_8_50_with_cap ... bench: 37 ns/iter (+/- 3) test small_vec::tests::fill_small_vec_8_50_wo_cap ... bench: 210 ns/iter (+/- 10) ``` After: ``` test small_vec::tests::fill_small_vec_1_10_wo_cap ... bench: 31 ns/iter (+/- 3) test small_vec::tests::fill_small_vec_1_50_with_cap ... bench: 39 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_1_50_wo_cap ... bench: 35 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_32_10_with_cap ... bench: 37 ns/iter (+/- 3) test small_vec::tests::fill_small_vec_32_10_wo_cap ... bench: 32 ns/iter (+/- 2) test small_vec::tests::fill_small_vec_32_50_with_cap ... bench: 52 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_32_50_wo_cap ... bench: 46 ns/iter (+/- 0) test small_vec::tests::fill_small_vec_8_10_with_cap ... bench: 35 ns/iter (+/- 4) test small_vec::tests::fill_small_vec_8_10_wo_cap ... bench: 31 ns/iter (+/- 0) test small_vec::tests::fill_small_vec_8_50_with_cap ... bench: 40 ns/iter (+/- 15) test small_vec::tests::fill_small_vec_8_50_wo_cap ... bench: 36 ns/iter (+/- 2) ```
2018-08-01Rollup merge of #52859 - ljedrz:smallvec_true_extend, r=Mark-SimulacrumPietro Albini-4/+128
Use Vec::extend in SmallVec::extend when applicable As calculated in #52738, `Vec::extend` is much faster than `push`ing to it in a loop. We can take advantage of this method in `SmallVec` too - at least in cases when its underlying object is an `AccumulateVec::Heap`. ~~This approach also accidentally improves the `push` loop of the `AccumulateVec::Array` variant, because it doesn't utilize `SmallVec::push` which performs `self.reserve(1)` with every iteration; this is unnecessary, because we're already reserving the whole space we will be needing by performing `self.reserve(iter.size_hint().0)` at the beginning.~~
2018-07-31Benchmarks for SmallVecljedrz-0/+116
2018-07-30Use Vec::extend in SmallVec::extend when applicableljedrz-4/+12
2018-07-30Auto merge of #52697 - ljedrz:misc_data_structures, r=Mark-Simulacrumbors-11/+5
Simplify a few functions in rustc_data_structures - drop `try!()` where it's superfluous - change `try!()` to `?` - squash a `push` with `push_str` - refactor a push loop into an iterator
2018-07-29Remove unused `mut`sMatthew Jasper-1/+1
2018-07-27Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrumbors-2/+0
Rollup of bare_trait_objects PRs All deny attributes were moved into bootstrap so they can be disabled with a line of config. Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free. r? @Mark-Simulacrum cc @ljedrz @kennytm