about summary refs log tree commit diff
path: root/src/librustc_data_structures/accumulate_vec.rs
AgeCommit message (Collapse)AuthorLines
2018-08-29Remove `AccumulateVec` and its uses.Nicholas Nethercote-242/+0
It's basically just a less capable version of `SmallVec`.
2018-07-24Simplify a few functions in rustc_data_structuresljedrz-3/+2
2018-07-17Avoid most allocations in `Canonicalizer`.Nicholas Nethercote-0/+7
Extra allocations are a significant cost of NLL, and the most common ones come from within `Canonicalizer`. In particular, `canonical_var()` contains this code: indices .entry(kind) .or_insert_with(|| { let cvar1 = variables.push(info); let cvar2 = var_values.push(kind); assert_eq!(cvar1, cvar2); cvar1 }) .clone() `variables` and `var_values` are `Vec`s. `indices` is a `HashMap` used to track what elements have been inserted into `var_values`. If `kind` hasn't been seen before, `indices`, `variables` and `var_values` all get a new element. (The number of elements in each container is always the same.) This results in lots of allocations. In practice, most of the time these containers only end up holding a few elements. This PR changes them to avoid heap allocations in the common case, by changing the `Vec`s to `SmallVec`s and only using `indices` once enough elements are present. (When the number of elements is small, a direct linear search of `var_values` is as good or better than a hashmap lookup.) The changes to `variables` are straightforward and contained within `Canonicalizer`. The changes to `indices` are more complex but also contained within `Canonicalizer`. The changes to `var_values` are more intrusive because they require defining a new type `SmallCanonicalVarValues` -- which is to `CanonicalVarValues` as `SmallVec` is to `Vec -- and passing stack-allocated values of that type in from outside. All this speeds up a number of NLL "check" builds, the best by 2%.
2018-03-29Move RangeArguments to {core::std}::ops and rename to RangeBoundsSimon Sapin-3/+2
These unstable items are deprecated: * The `std::collections::range::RangeArgument` reexport * The `std::collections::range` module.
2017-08-15Fix typos & us spellingsFourchaux-1/+1
2017-06-30Revert "Stabilize RangeArgument"Steven Fackler-1/+2
This reverts commit 143206d54d7558c2326212df99efc98110904fdb.
2017-06-24Stabilize RangeArgumentSteven Fackler-2/+1
Move it and Bound to core::ops while we're at it. Closes #30877
2017-03-27Fix various useless derefs and slicingsOliver Schneider-4/+4
2017-01-29Remove dead recursive partial eq implest31-1/+1
Its nowhere used (if it had been used used, the rust stack would have overflown due to the recursion). Its presence was confusing for mrustc.
2017-01-03Add drain method to AccumulateVec/ArrayVecAndrew Cann-0/+39
You can now call .drain(..) on SmallVec, AccumulateVec and ArrayVec
2016-11-11Change implementation of syntax::util::SmallVector to use ↵Mark-Simulacrum-6/+152
data_structures::SmallVec.
2016-10-25Add AccumulateVec, a potentially stack-allocated vector.Mark-Simulacrum-0/+52
AccumulateVec is generic over the Array trait, which is currently only implemented for [T; 8].