about summary refs log tree commit diff
path: root/src/librustc_data_structures
AgeCommit message (Collapse)AuthorLines
2018-04-28Auto merge of #50240 - nnethercote:LazyBTreeMap, r=cramertjbors-0/+109
Implement LazyBTreeMap and use it in a few places. This is a thin wrapper around BTreeMap that avoids allocating upon creation. I would prefer to change BTreeMap directly to make it lazy (like I did with HashSet in #36734) and I initially attempted that by making BTreeMap::root an Option<>. But then I also had to change Iter and Range to handle trees with no root, and those types have stability markers on them and I wasn't sure if that was acceptable. Also, BTreeMap has a lot of complex code and changing it all was challenging, and I didn't have high confidence about my general approach. So I prototyped this wrapper instead and used it in the hottest locations to get some measurements about the effect. The measurements are pretty good! - Doing a debug build of serde, it reduces the total number of heap allocations from 17,728,709 to 13,359,384, a 25% reduction. The number of bytes allocated drops from 7,474,672,966 to 5,482,308,388, a 27% reduction. - It gives speedups of up to 3.6% on some rustc-perf benchmark jobs. crates.io, futures, and serde benefit most. ``` futures-check avg: -1.9% min: -3.6% max: -0.5% serde-check avg: -2.1% min: -3.5% max: -0.7% crates.io-check avg: -1.7% min: -3.5% max: -0.3% serde avg: -2.0% min: -3.0% max: -0.9% serde-opt avg: -1.8% min: -2.9% max: -0.3% futures avg: -1.5% min: -2.8% max: -0.4% tokio-webpush-simple-check avg: -1.1% min: -2.2% max: -0.1% futures-opt avg: -1.2% min: -2.1% max: -0.4% piston-image-check avg: -0.8% min: -1.1% max: -0.3% crates.io avg: -0.6% min: -1.0% max: -0.3% ``` @Gankro, how do you think I should proceed here? Is leaving this as a wrapper reasonable? Or should I try to make BTreeMap itself lazy? If so, can I change the representation of Iter and Range? Thanks!
2018-04-26rustc_target: move in syntax::abi and flip dependency.Irina Popa-0/+5
2018-04-26Implement LazyBTreeMap and use it in a few places.Nicholas Nethercote-0/+109
This is a thin wrapper around BTreeMap that avoids allocating upon creation. It speeds up some rustc-perf benchmarks by up to 3.6%.
2018-04-16Auto merge of #48945 - clarcharr:iter_exhaust, r=Kimundibors-2/+2
Replace manual iterator exhaust with for_each(drop) This originally added a dedicated method, `Iterator::exhaust`, and has since been replaced with `for_each(drop)`, which is more idiomatic. <del>This is just shorthand for `for _ in &mut self {}` or `while let Some(_) = self.next() {}`. This states the intent a lot more clearly than the identical code: run the iterator to completion. <del>At least personally, my eyes tend to gloss over `for _ in &mut self {}` without fully paying attention to what it does; having a `Drop` implementation akin to: <del>`for _ in &mut self {}; unsafe { free(self.ptr); }`</del> <del>Is not as clear as: <del>`self.exhaust(); unsafe { free(self.ptr); }` <del>Additionally, I've seen debate over whether `while let Some(_) = self.next() {}` or `for _ in &mut self {}` is more clear, whereas `self.exhaust()` is clearer than both.
2018-04-12Auto merge of #49558 - Zoxc:sync-misc, r=michaelwoeristerbors-0/+198
Even more thread-safety changes r? @michaelwoerister
2018-04-11Auto merge of #49715 - Mark-Simulacrum:deny-warnings, r=alexcrichtonbors-1/+0
Move deny(warnings) into rustbuild This permits easier iteration without having to worry about warnings being denied. Fixes #49517
2018-04-10Add a Once type for values which are only written onceJohn Kåre Alsaker-0/+129
2018-04-10Add insert_same extension to HashMapJohn Kåre Alsaker-0/+14
2018-04-10Add OneThread which only allows its inner value to be used in one threadJohn Kåre Alsaker-0/+55
2018-04-10Auto merge of #49390 - Zoxc:sync-syntax, r=michaelwoeristerbors-0/+12
More thread-safety changes r? @michaelwoerister
2018-04-08Move deny(warnings) into rustbuildMark Simulacrum-1/+0
This permits easier iteration without having to worry about warnings being denied. Fixes #49517
2018-04-05Bump the bootstrap compiler to 1.26.0 betaAlex Crichton-4/+0
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language features!
2018-04-04Replace manual iter exhaust with for_each(drop).Clar Charr-2/+2
2018-04-02avoid IdxSets containing garbage above the universe lengthAriel Ben-Yehuda-1/+73
This makes sure that all bits in each IdxSet between the universe length and the end of the word are all zero instead of being in an indeterminate state. This fixes a crash with RUST_LOG=rustc_mir, and is probably a good idea anyway.
2018-03-31Auto merge of #49201 - Phlosioneer:add-trivial-size-hints, r=SimonSapinbors-0/+18
Implement some trivial size_hints for various iterators This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708. I intend to do more, but I don't want to make the PR too large.
2018-03-29Move RangeArguments to {core::std}::ops and rename to RangeBoundsSimon Sapin-9/+7
These unstable items are deprecated: * The `std::collections::range::RangeArgument` reexport * The `std::collections::range` module.
2018-03-29Move alloc::Bound to {core,std}::opsSimon Sapin-1/+1
The stable reexport `std::collections::Bound` is now deprecated. Another deprecated reexport could be added in `alloc`, but that crate is unstable.
2018-03-29Stabilize underscore lifetimesTaylor Cramer-1/+1
2018-03-28Add try_write to RwLockJohn Kåre Alsaker-0/+12
2018-03-26Stabilize i128 feature tooMark Mansi-2/+1
2018-03-26Stabilize i128_typeMark Mansi-1/+1
2018-03-26Stabilize conservative_impl_traitTaylor Cramer-1/+1
2018-03-26Stabilize universal_impl_traitTaylor Cramer-1/+1
2018-03-23Rollup merge of #49030 - Zoxc:misc, r=michaelwoeristerAlex Crichton-30/+15
Misc changes from my parallel rustc branch r? @michaelwoerister
2018-03-23Rollup merge of #48265 - SimonSapin:nonzero, r=KodrAusAlex Crichton-3/+3
Add 12 num::NonZero* types for primitive integers, deprecate core::nonzero RFC: https://github.com/rust-lang/rfcs/pull/2307 Tracking issue: ~~https://github.com/rust-lang/rust/issues/27730~~ https://github.com/rust-lang/rust/issues/49137 Fixes https://github.com/rust-lang/rust/issues/27730
2018-03-20Implement some trivial size_hints for various iteratorsPhlosioneer-0/+18
This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708.
2018-03-19Convert SerializedDepGraph to be a struct-of-arraysWesley Wiser-0/+7
Fixes #47326
2018-03-17Use num::NonZero* instead of NonZero<_> in rustc and testsSimon Sapin-3/+3
2018-03-17Add OnDropJohn Kåre Alsaker-0/+8
2018-03-17Add an Default impl for LockJohn Kåre Alsaker-0/+7
2018-03-17Remove rustc_global!John Kåre Alsaker-30/+0
2018-03-15Rollup merge of #48840 - varkor:idxset-cleanup, r=pnkfelixkennytm-64/+0
Remove some unnecessary IdxSet methods This replaces `IdxSet:: reset_to_empty` with `IdxSet:: clear`, and `IdxSet::elems`/`IdxSet::each_bit` with `IdxSet::iter`. Based on some [comments on #rustc](https://botbot.me/mozilla/rustc/2018-01-23/?msg=96063396). r? @pnkfelix
2018-03-13add `canonicalize` method to `InferCtxt` [VIC]Niko Matsakis-1/+1
2018-03-09Move PROFQ_CHAN to a Session fieldJohn Kåre Alsaker-23/+0
2018-03-08Rollup merge of #48808 - Zoxc:reg-diag, r=michaelwoeristerManish Goregaokar-39/+87
Move REGISTERED_DIAGNOSTICS to a ParseSess field r? @michaelwoerister
2018-03-08Rollup merge of #48699 - frewsxcv:frewsxcv-impl-trait, r=nikomatsakisManish Goregaokar-99/+53
Replace iterator structures with `impl Trait`. Two commits: * Replace iterator structures with `impl Trait`. * Run rustfmt on `src/librustc_data_structures/graph/mod.rs`.
2018-03-08Produce instead of pointersOliver Schneider-0/+8
2018-03-08Add with_lock, with_read_lock and with_write_lockJohn Kåre Alsaker-39/+87
2018-03-07Run rustfmt on `src/librustc_data_structures/graph/mod.rs`.Corey Farwell-24/+29
2018-03-07Replace iterator structures with `impl Trait`.Corey Farwell-77/+26
2018-03-07Merge branch 'metadata-send-sync' of https://github.com/Zoxc/rust into ↵Alex Crichton-7/+43
update-cargo
2018-03-07Make metadata references Send + SyncJohn Kåre Alsaker-7/+43
2018-03-06Remove IdxSet::elemsvarkor-26/+0
2018-03-06Remove IdxSet::each_bitvarkor-33/+0
2018-03-06Remove IdxSet::reset_to_emptyvarkor-5/+0
2018-03-05while let all the thingsleonardo.yvens-7/+1
2018-03-04Auto merge of #48587 - Zoxc:transitive-relation, r=nikomatsakisbors-10/+10
Make TransitiveRelation thread safe. Avoid locking by using get_mut in some cases r? @nikomatsakis
2018-03-01Bump enaSean Griffin-1/+1
2018-03-01Remove dead codeSean Griffin-798/+0
These modules were replaced with re-exports from ena
2018-03-01obtain `UnificationTable` and `snapshot_vec` from `ena` insteadNiko Matsakis-2/+4
The ena version has an improved interface. I suspect `librustc_data_structures` should start migrating out to crates.io in general.