Commit Graph

12 Commits

Author SHA1 Message Date
KRAAI, MATTHEW [VISUS] cb152eae2f Remove blank line 2020-06-26 06:22:35 -07:00
LeSeulArtichaut 39e29ce4d0 #[deny(unsafe_op_in_unsafe_fn)] in liballoc 2020-06-19 13:47:01 +02:00
Nicholas Nethercote f4b9dc31f6 Tiny Vecs are dumb.
Currently, if you repeatedly push to an empty vector, the capacity
growth sequence is 0, 1, 2, 4, 8, 16, etc. This commit changes the
relevant code (the "amortized" growth strategy) to skip 1 and 2 in most
cases, instead using 0, 4, 8, 16, etc. (You can still get a capacity of
1 or 2 using the "exact" growth strategy, e.g. via `reserve_exact()`.)

This idea (along with the phrase "tiny Vecs are dumb") comes from the
"doubling" growth strategy that was removed from `RawVec` in #72013.
That strategy was barely ever used -- only when a `VecDeque` was grown,
oddly enough -- which is why it was removed in #72013.

(Fun fact: until just a few days ago, I thought the "doubling" strategy
was used for repeated push case. In other words, this commit makes
`Vec`s behave the way I always thought they behaved.)

This change reduces the number of allocations done by rustc itself by
10% or more. It speeds up rustc, and will also speed up any other Rust
program that uses `Vec`s a lot.
2020-05-18 15:26:59 +10:00
Tim Diekmann 03b055b0b4 Remove alignment from MemoryBlock 2020-03-26 17:14:12 +01:00
Tim Diekmann 2526accdd3 Fix issues from review and unsoundness of RawVec::into_box 2020-03-26 17:11:47 +01:00
Tim Diekmann 56cbf2f22a Overhaul of the AllocRef trait to match allocator-wg's latest consens 2020-03-26 17:10:54 +01:00
Tim Diekmann f77afc8f9c Allow ZSTs in AllocRef 2020-03-08 11:01:12 +01:00
Tim Diekmann d8e3557dba Remove usable_size APIs 2020-03-03 00:08:24 +01:00
Tim Diekmann 7ca25db816 Rename Alloc to AllocRef 2020-01-27 21:39:51 +01:00
David Tolnay 1c4d453969 Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
Alexander Regueiro b0006dff10 A few cosmetic improvements to code & comments in liballoc and libcore 2019-09-06 16:02:25 +01:00
Vadim Petrochenkov 3d0d6ee271 liballoc: Unconfigure tests during normal build
Remove additional libcore-like restrictions from liballoc, turns out the testing works ok if the tests are a part of liballoc itself.
2019-08-02 01:59:01 +03:00