rust/src/libsyntax_ext
bors 866a713258 Auto merge of #52738 - ljedrz:push_to_extend, r=eddyb
Replace push loops with extend() where possible

Or set the vector capacity where I couldn't do it.

According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop:

10 elements (6.1 times faster):
```
test bench_extension ... bench:          75 ns/iter (+/- 23)
test bench_push_loop ... bench:         458 ns/iter (+/- 142)
```

100 elements (11.12 times faster):
```
test bench_extension ... bench:          87 ns/iter (+/- 26)
test bench_push_loop ... bench:         968 ns/iter (+/- 3,528)
```

1000 elements (11.04 times faster):
```
test bench_extension ... bench:         311 ns/iter (+/- 9)
test bench_push_loop ... bench:       3,436 ns/iter (+/- 233)
```

Seems like a good idea to use `extend` as much as possible.
2018-07-29 21:37:47 +00:00
..
deriving Replace push loops with collect() and extend() where possible 2018-07-29 18:53:22 +02:00
asm.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00
assert.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00
Cargo.toml rustc_target: move in syntax::abi and flip dependency. 2018-04-26 17:49:16 +03:00
cfg.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00
compile_error.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00
concat.rs Prefer to_string() to format!() 2018-07-27 11:11:18 +02:00
concat_idents.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00
diagnostics.rs Add E0665 2018-05-21 15:41:19 +02:00
env.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00
format.rs Replace push loops with collect() and extend() where possible 2018-07-29 18:53:22 +02:00
format_foreign.rs Rollup merge of #52649 - estebank:fmt-span, r=oli-obk 2018-07-26 09:18:30 -06:00
global_asm.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00
lib.rs Deny bare_trait_objects globally 2018-07-25 10:25:29 +09:00
log_syntax.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00
proc_macro_impl.rs Do not capture stderr in the compiler. Instead just panic silently for fatal errors 2018-01-26 04:52:30 +01:00
proc_macro_registrar.rs Auto merge of #52383 - petrochenkov:pmns, r=alexcrichton 2018-07-15 19:35:06 +00:00
trace_macros.rs Deny bare trait objects in src/libsyntax_ext 2018-07-12 11:58:16 +02:00