rust/src
bors 672b272077 Auto merge of #72227 - nnethercote:tiny-vecs-are-dumb, r=Amanieu
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, 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.

In theory, the change could increase memory usage, but in practice it
doesn't. It would be an unusual program where very small `Vec`s having a
capacity of 4 rather than 1 or 2 would make a difference. You'd need a
*lot* of very small `Vec`s, and/or some very small `Vec`s with very
large elements.

r? @Amanieu
2020-05-19 15:12:12 +00:00
..
bootstrap bootstrap: fix typo 2020-05-17 11:41:20 +02:00
build_helper
ci Update pacman first 2020-05-18 20:38:59 +02:00
doc Rollup merge of #72290 - elichai:2020-doc-lto, r=wesleywiser 2020-05-18 19:04:06 +02:00
etc Enforce Python 3 as much as possible 2020-04-10 09:09:58 -04:00
liballoc Auto merge of #72227 - nnethercote:tiny-vecs-are-dumb, r=Amanieu 2020-05-19 15:12:12 +00:00
libarena Be less aggressive with DroplessArena/TypedArena growth. 2020-05-13 11:35:32 +10:00
libcore Rollup merge of #72344 - kornelski:assertdoc, r=Mark-Simulacrum 2020-05-19 13:53:47 +02:00
libfmt_macros Dogfood more or_patterns in the compiler 2020-04-19 07:33:58 -07:00
libgraphviz
libpanic_abort Bump bootstrap compiler 2020-04-25 09:25:33 -04:00
libpanic_unwind make abort intrinsic safe, and correct its documentation 2020-05-17 11:23:42 +02:00
libproc_macro Rollup merge of #72233 - dtolnay:literal, r=petrochenkov 2020-05-17 01:51:30 +02:00
libprofiler_builtins Require compiler-rt root at ../src/llvm-project/compiler-rt 2020-04-11 17:49:16 -04:00
librustc_apfloat Dogfood more or_patterns in the compiler 2020-04-19 07:33:58 -07:00
librustc_ast Rollup merge of #72047 - Julian-Wollersberger:literal_error_reporting_cleanup, r=petrochenkov 2020-05-16 19:46:31 +02:00
librustc_ast_lowering use min_specialization for some rustc crates where it requires no changes 2020-05-10 11:25:00 +02:00
librustc_ast_passes Disallow forbidden usage of non-ascii identifiers. 2020-05-17 01:31:18 +08:00
librustc_ast_pretty Fix tests 2020-05-08 13:57:08 +02:00
librustc_attr Fix clippy warnings 2020-05-11 17:13:32 +02:00
librustc_builtin_macros Remove ast::{Ident, Name} reexports. 2020-05-08 13:13:15 +02:00
librustc_codegen_llvm Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu 2020-05-17 21:22:48 +00:00
librustc_codegen_ssa Auto merge of #72208 - tmandry:fix-fuchsia-solink, r=Mark-Simulacrum 2020-05-17 05:58:54 +00:00
librustc_data_structures Auto merge of #72079 - semarie:openbsd-stacker, r=Mark-Simulacrum 2020-05-16 03:55:49 +00:00
librustc_driver rustc_driver::main: more informative return type 2020-05-11 00:11:42 +02:00
librustc_error_codes Rollup merge of #72259 - crlf0710:ascii_only_check, r=petrochenkov 2020-05-17 16:24:26 +02:00
librustc_errors Simplify the error Registry methods a little 2020-05-04 11:52:15 -07:00
librustc_expand Auto merge of #68717 - petrochenkov:stabexpat, r=varkor 2020-05-19 03:11:32 +00:00
librustc_feature merge lazy_normalization_consts into const_generics 2020-05-17 11:06:35 +02:00
librustc_fs_util
librustc_hir bless ui tests 2020-05-11 14:06:57 +08:00
librustc_hir_pretty Remove ast::{Ident, Name} reexports. 2020-05-08 13:13:15 +02:00
librustc_incremental Change WorkProduct::saved_files to an Option. 2020-05-12 17:55:07 +10:00
librustc_index Redesign the Step trait 2020-04-08 02:24:16 -04:00
librustc_infer Rollup merge of #72066 - lcnr:const-type-info-err, r=varkor 2020-05-19 13:53:41 +02:00
librustc_interface rustc_target: Stop using "string typing" for code models 2020-05-16 12:02:11 +03:00
librustc_lexer Replace some usages of the old unescape_ functions in AST, clippy and tests. 2020-05-13 10:05:04 +02:00
librustc_lint Assume unevaluated consts are equal to the other consts and add ConstEquate obligation. This delays 2020-05-17 11:01:02 +02:00
librustc_llvm Don't skip building LLVM if already built 2020-05-02 18:43:55 -04:00
librustc_macros Monomorphise load_from_disk_and_cache_in_memory. 2020-05-01 14:29:35 +02:00
librustc_metadata use min_specialization for some rustc crates where it requires no changes 2020-05-10 11:25:00 +02:00
librustc_middle Rollup merge of #71973 - lcnr:lazy-norm, r=nikomatsakis 2020-05-18 19:04:03 +02:00
librustc_mir Rollup merge of #72283 - jonas-schievink:elaborate-drop-elaboration, r=cramertj 2020-05-18 19:04:04 +02:00
librustc_mir_build Remove lang_items\(\).*\.unwrap\(\) 2020-05-15 12:31:12 +01:00
librustc_parse Rollup merge of #72254 - ehuss:double-backtick, r=dtolnay 2020-05-16 19:46:37 +02:00
librustc_passes Fix clippy warnings 2020-05-11 17:13:32 +02:00
librustc_plugin_impl Remove ast::{Ident, Name} reexports. 2020-05-08 13:13:15 +02:00
librustc_privacy Remove ty::UnnormalizedProjection 2020-05-12 01:56:29 -04:00
librustc_query_system Rollup merge of #72126 - nnethercote:change-WorkProduct-saved_files, r=alexcrichton 2020-05-14 18:21:50 +02:00
librustc_resolve Remove ast::{Ident, Name} reexports. 2020-05-08 13:13:15 +02:00
librustc_save_analysis Fix ICE in -Zsave-analysis 2020-05-18 22:55:04 +01:00
librustc_session Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu 2020-05-17 21:22:48 +00:00
librustc_span merge lazy_normalization_consts into const_generics 2020-05-17 11:06:35 +02:00
librustc_symbol_mangling Remove ty::UnnormalizedProjection 2020-05-12 01:56:29 -04:00
librustc_target rustc_target: Stop using "string typing" for code models 2020-05-16 12:02:11 +03:00
librustc_trait_selection Logically seperate lazy norm from const_generics 2020-05-17 11:06:35 +02:00
librustc_traits chalk 2020-05-17 11:06:35 +02:00
librustc_ty Remove ty::UnnormalizedProjection 2020-05-12 01:56:29 -04:00
librustc_typeck Rollup merge of #72068 - estebank:mut-deref-hack, r=oli-obk 2020-05-19 13:53:43 +02:00
librustdoc Assume unevaluated consts are equal to the other consts and add ConstEquate obligation. This delays 2020-05-17 11:01:02 +02:00
libserialize use min_specialization for some rustc crates where it requires no changes 2020-05-10 11:25:00 +02:00
libstd Auto merge of #71447 - cuviper:unsized_cow, r=dtolnay 2020-05-19 08:08:48 +00:00
libterm Replace filter_map().next() calls with find_map() 2020-04-24 20:03:45 -07:00
libtest Fix clippy warnings 2020-05-11 17:13:32 +02:00
libunwind Use -fvisibility=hidden for libunwind 2020-05-05 12:41:23 -07:00
llvm-project@3ba91917e5 Store LLVM bitcode in object files, not compressed 2020-04-29 11:57:26 -07:00
rtstartup
rustc
rustllvm Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu 2020-05-17 21:22:48 +00:00
stdarch@ec6fccd34c Update stdarch 2020-05-09 16:03:40 -04:00
test Rollup merge of #72338 - doctorn:trait-object-ice, r=ecstatic-morse 2020-05-19 13:53:45 +02:00
tools Auto merge of #68717 - petrochenkov:stabexpat, r=varkor 2020-05-19 03:11:32 +00:00
README.md
stage0.txt Bump rustfmt to most recently shipped 2020-04-25 09:25:33 -04:00

This directory contains the source code of the rust project, including:

  • rustc and its tests
  • libstd
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.