242 Commits

Author SHA1 Message Date
Nicholas Nethercote
40d4868b39 Be less aggressive with DroplessArena/TypedArena growth.
`DroplessArena` and `TypedArena` use an aggressive growth strategy: the
first chunk is 4 KiB, the second is 8 KiB, and it keeps on doubling
indefinitely. DHAT profiles show that sometimes this results in large
chunks (e.g. 16-128 MiB) that are barely filled. Although these don't
contribute to RSS, they clog up the DHAT profiles.

This commit changes things so that the doubling stops at 2 MiB. This is
large enough that chunk allocations are still rare (you might get 100s
instead of 10s of them) but avoids lots of unused space in the worst
case. It gives a slight speed-up to cycle counts in some cases.
2020-05-13 11:35:32 +10:00
Nicholas Nethercote
9111d8b66e Fix the new capacity measurement in arenas.
For the given code paths, the amount of space used in the previous chunk
is irrelevant.

(This will almost never make a difference to behaviour, but it makes the
code clearer.)
2020-05-13 11:29:16 +10:00
Mazdak Farrokhzad
0f68ab03c3 separate out an arena for HIR 2020-03-21 22:18:57 +01:00
Mazdak Farrokhzad
4c28d68bc3 move move stuff into declare_arena! 2020-03-21 22:18:57 +01:00
Mazdak Farrokhzad
6aff92a7d2 move DropArena -> libarena 2020-03-21 22:18:57 +01:00
John Kåre Alsaker
f4968c8e00 Remove SyncTypedArena, SyncDroplessArena and in_arena 2020-01-11 07:56:45 +01:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Camille GILLOT
d84eb506e2 Fix TypedArena. 2019-12-03 23:35:40 +01:00
Yuki Okushi
f10d2e2d23 Fix clippy warnings 2019-10-01 23:15:47 +09:00
Vadim Petrochenkov
676d282dd3 Deny unused_lifetimes through rustbuild 2019-07-28 18:47:02 +03:00
Vadim Petrochenkov
434152157f Remove lint annotations in specific crates that are already enforced by rustbuild
Remove some random unnecessary lint `allow`s
2019-07-28 18:46:24 +03:00
bors
890881f8f4 Auto merge of #60340 - mgeier:cap-vs-capacity, r=alexcrichton
Rename .cap() methods to .capacity()

As mentioned in #60316, there are a few `.cap()` methods, which seem out-of-place because such methods are called `.capacity()` in the rest of the code.

This PR renames them to `.capacity()` but leaves `RawVec::cap()` in there for backwards compatibility.

I didn't try to mark the old version as "deprecated", because I guess this would cause too much noise.
2019-07-25 18:45:42 +00:00
flip1995
084c829fb8
Enable internal lints in bootstrap 2019-06-24 10:45:20 +02:00
Lzu Tao
7d69d4ced2 Make use of ptr::null(_mut) instead of casting zero 2019-06-17 10:52:46 +00:00
chansuke
40a0c835b5 Separate libarena::lib module 2019-06-16 13:08:09 +03:00
Eduard-Mihai Burtescu
630ec8880c Add deny(unused_lifetimes) to all the crates that have deny(internal). 2019-06-11 14:11:59 +03:00
John Kåre Alsaker
ba5d9c094d Optimize alloc_from_iter 2019-05-23 18:51:46 +02:00
Matthias Geier
0967d28be7 Rename .cap() methods to .capacity()
... but leave the old names in there for backwards compatibility.
2019-04-27 22:43:10 +02:00
Mateusz Mikuła
87e4b43d51 Deny internal in stage0 2019-04-17 05:15:00 +02:00
Mazdak Farrokhzad
bdb264ff5f
Rollup merge of #59675 - SimonSapin:stable-alloc, r=alexcrichton
Stabilize the `alloc` crate.

This implements RFC 2480:

* https://github.com/rust-lang/rfcs/pull/2480
* https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md

Closes https://github.com/rust-lang/rust/issues/27783
2019-04-14 00:23:25 +02:00
Simon Sapin
fc928a18ba Stabilize the alloc crate.
This implements RFC 2480:

* https://github.com/rust-lang/rfcs/pull/2480
* https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md

Closes https://github.com/rust-lang/rust/issues/27783
2019-04-12 20:07:30 +02:00
flip1995
d3f0cb9b62
Deny internal lints on non conflicting crates
- libarena
- librustc_allocator
- librustc_borrowck
- librustc_codegen_ssa
- librustc_codegen_utils
- librustc_driver
- librustc_errors
- librustc_incremental
- librustc_metadata
- librustc_passes
- librustc_privacy
- librustc_resolve
- librustc_save_analysis
- librustc_target
- librustc_traits
- libsyntax
- libsyntax_ext
- libsyntax_pos
2019-04-03 18:24:21 +02:00
John Kåre Alsaker
59ff059cfc Add ensure_capacity and rename min to len 2019-04-01 22:35:13 +02:00
John Kåre Alsaker
e8b3aea4d6 Use set_len 2019-04-01 21:52:13 +02:00
John Kåre Alsaker
30e7e9c5f0 Support allocating iterators with arenas 2019-04-01 21:47:55 +02:00
Mazdak Farrokhzad
f996e2b6dc libarena => 2018 2019-02-11 23:49:48 +01:00
Guillaume Gomez
8b886e07f5 Remove images' url to make it work even without internet connection 2019-02-07 11:06:19 +01:00
Oliver Scherer
03b892860d Check the correct arena 2019-01-01 20:06:50 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors
9abc231212 Auto merge of #56378 - ljedrz:arena_tweaks, r=nagisa
arena: speed up TypedArena::clear and improve common patterns

- speed up `TypedArena::clear`: improves its performance by up to **33%** (in case of a single entry)
- simplify `DroplessArena::in_arena`
2018-12-02 11:14:14 +00:00
ljedrz
95f32f1ebd arena: improve common patterns 2018-12-02 08:18:46 +01:00
ljedrz
ca0806c703 arena: speed up TypedArena::clear 2018-11-30 16:36:20 +01:00
John Kåre Alsaker
946ea1453d Inline things 2018-11-30 08:14:22 +01:00
Oliver Scherer
bf3d40aa7e Update TypedArena tests 2018-10-19 14:34:44 +02:00
Oliver Scherer
3c9258e604 Prefer Default::default over FxHash*::default in struct constructors 2018-10-19 14:34:44 +02:00
Josh Stone
ce034951fb Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
toidiu
731f4efae5 stabalize infer outlives requirements (RFC 2093).
Co-authored-by: nikomatsakis
2018-09-11 11:40:04 -04:00
Niko Matsakis
73fb1622b3 check that adding infer-outlives requirement to all crates works 2018-08-24 17:10:50 -04:00
Corey Farwell
993fb93464 Replace usages of ptr::offset with ptr::{add,sub}. 2018-08-20 07:28:34 -04:00
memoryruins
d2e0c782a9 [nll] libarena: enable feature(nll) for bootstrap 2018-08-09 04:07:59 -04:00
Tatsuyuki Ishi
e098985939 Deny bare_trait_objects globally 2018-07-25 10:25:29 +09:00
ljedrz
5058af7003 Deny bare trait objects in the rest of rust 2018-07-12 13:50:22 +02:00
Simon Sapin
1acbb0a935 Make raw_vec perma-unstable and hidden 2018-06-29 14:01:33 +02:00
John Kåre Alsaker
6c2d875261 Make &Slice a thin pointer 2018-05-27 17:28:35 +02:00
Mark Simulacrum
9e3432447a Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
John Kåre Alsaker
19d44f2d24 Make arenas thread safe 2018-04-15 20:53:03 +02:00
Mark Simulacrum
c115cc655c Move deny(warnings) into rustbuild
This permits easier iteration without having to worry about warnings
being denied.

Fixes #49517
2018-04-08 16:59:14 -06:00
Vadim Petrochenkov
1a2a23447e Stabilize attributes on generic parameters 2018-04-05 02:19:56 +03:00
kennytm
30a35164ce Rollup merge of #47069 - Kagamihime:master, r=nrc
rustfmt libarena/lib.rs

Note: it's my very first pull request. I'm trying to do something very simple to see how it works here, even if it's a tiny change or maybe it's not correct (sorry if it is the case).

r? @nrc
2018-01-13 02:26:23 +08:00
Malo Jaffré
cbb32a9418 Fix docs for future pulldown migration 2018-01-01 14:44:12 +01:00