Commit graph

126577 commits

Author SHA1 Message Date
The8472
7492f76f77 please tidy 2020-09-03 20:59:34 +02:00
The8472
9aeea00222 get things to work under min_specialization by leaning more heavily on #[rustc_unsafe_specialization_marker] 2020-09-03 20:59:34 +02:00
The8472
7badb7a7f8 avoid applying in-place collect specialization in type-length test
the test was sized to match external iteration only, since
vec's in-place collect now uses internal iteration we collect into
a different type now.
Note that any other try-fold based operation such as count() would also
have exceeded the type length limit for that iterator.
2020-09-03 20:59:33 +02:00
The8472
a62cd1b44c fix benchmark compile errors 2020-09-03 20:59:33 +02:00
The8472
bec9f9223c apply required min_specialization attributes 2020-09-03 20:59:32 +02:00
The8472
80638330f2 support in-place collect for MapWhile adapters 2020-09-03 20:59:32 +02:00
The8472
55d1296a55 pacify tidy 2020-09-03 20:59:31 +02:00
The8472
5530858a08 generalize in-place collect to types of same size and alignment 2020-09-03 20:59:31 +02:00
The8472
fa34b39cd6 increase comment verbosity 2020-09-03 20:59:30 +02:00
The8472
872ab780c0 work around compiler overhead around lambdas in generics by extracting them into free functions 2020-09-03 20:59:29 +02:00
The8472
771b8ecc83 extract IntoIter drop/forget used by specialization into separate methods 2020-09-03 20:59:29 +02:00
The8472
6ad133443a add benchmark to cover in-place extend 2020-09-03 20:59:28 +02:00
The8472
a7a8b52e91 remove redundant cast 2020-09-03 20:59:28 +02:00
The8472
470bf54f94 test drops during in-place iteration 2020-09-03 20:59:27 +02:00
The8472
fe350dd82d move unsafety into method, not relevant to caller 2020-09-03 20:59:27 +02:00
The8472
0d2d033415 replace unsafe ptr::write with deref-write, benchmarks show no difference 2020-09-03 20:59:26 +02:00
The8472
9596e5a2f2 pacify tidy 2020-09-03 20:59:26 +02:00
The8472
6ed05fd995 replace drop flag with ManuallyDrop 2020-09-03 20:59:25 +02:00
The8472
ab382b7661 mark as_inner as unsafe and update comments 2020-09-03 20:59:24 +02:00
The8472
2a51e579f5 avoid exposing that binary heap's IntoIter is backed by vec::IntoIter, use a private trait instead 2020-09-03 20:59:24 +02:00
The8472
c731648e77 fix: bench didn't black_box its results 2020-09-03 20:59:23 +02:00
The8472
0856771248 fix build issue due to stabilized feature 2020-09-03 20:59:23 +02:00
The8472
e85cfa4f22 impl TrustedRandomAccess for vec::IntoIter 2020-09-03 20:59:22 +02:00
The8472
e1151844fa bench larger allocations 2020-09-03 20:59:22 +02:00
The8472
fd16202e36 include in-place .zip() in test 2020-09-03 20:59:21 +02:00
The8472
fbb3371e5b remove unecessary feature flag
# Conflicts:
#	library/alloc/src/lib.rs
2020-09-03 20:59:21 +02:00
The8472
70293c658f make tidy happy 2020-09-03 20:59:20 +02:00
The8472
21a17d105c support in-place iteration for most adapters
`Take` is not included since users probably call it with small constants
and it doesn't make sense to hold onto huge allocations in that case
2020-09-03 20:59:20 +02:00
The8472
085eb20a61 move free-standing method into trait impl 2020-09-03 20:59:19 +02:00
The8472
0f122e1119 add in-place iteration for Zip
this picks the left hand side as source since it might be more natural to
consume that as IntoIter source
2020-09-03 20:59:19 +02:00
The8472
3d5e9f1904 bench in-place zip 2020-09-03 20:59:18 +02:00
The8472
2b0b2ae9f6 additional specializations tests 2020-09-03 20:59:17 +02:00
The8472
00a32eb54f fix some in-place-collect edge-cases
- it's an allocation optimization, so don't attempt to do it on ZSTs
- drop the tail of partially exhausted iters
2020-09-03 20:59:17 +02:00
The8472
8c816b96dd remove redundant code 2020-09-03 20:59:16 +02:00
The8472
cc67c8eb91 improve comments 2020-09-03 20:59:16 +02:00
The8472
290fe895ba specialize creating a Vec from a slice iterator where T: Copy
this was already implemented for Extend but not for FromIterator
2020-09-03 20:59:15 +02:00
The8472
dac0edfaaa restore SpecFrom<T, TrustedLen<Item=T>> specialization by nesting
specializations
2020-09-03 20:59:15 +02:00
The8472
582fbb1d62 use From specializations on extend if extended Vec is empty
this enables in-place iteration and allocation reuse in additional cases
2020-09-03 20:59:14 +02:00
The8472
a596ff36b5 exercise more of the in-place pipeline in the bench 2020-09-03 20:59:14 +02:00
The8472
a9c78e371e bench in-place collect of droppables 2020-09-03 20:59:13 +02:00
The8472
8ac96e6a98 cyclic in-place reuse bench 2020-09-03 20:59:13 +02:00
The8472
bb4f888a59 return the things under test so they get black_box()'ed 2020-09-03 20:59:12 +02:00
The8472
2f700d085a add benches from bluss' gists 2020-09-03 20:59:12 +02:00
The8472
a4e385a0d0 use memmove instead of generic in-place iteration for IntoIter source
this is the original SpecExtend<_, IntoIter> logic except generalizing
the fast-path to include a memmove
2020-09-03 20:59:11 +02:00
The8472
631543dcb4 restore Vec::extend specialization for vec::IntoIter sources that
was lost during refactoring
2020-09-03 20:59:11 +02:00
The8472
07a8c1b95a hide binary_heap::IntoIter internals behind impl Trait 2020-09-03 20:59:10 +02:00
The8472
b90816deb7 remove example that relied on non-public trait 2020-09-03 20:59:10 +02:00
The8472
232065074d recover vectorization
switch to try_fold and segregate the drop handling to keep
collect::<Vec<u8>>() and similar optimizer-friendly

It comes at the cost of less accurate debug_asserts and code complexity
2020-09-03 20:59:09 +02:00
The8472
6c5c47b82b update benches 2020-09-03 20:59:09 +02:00
The8472
bead910b21 simplify pointer arithmetic 2020-09-03 20:59:08 +02:00