File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,3 +78,15 @@ The same is true for related iterators:
7878[ `slice::rchunks_exact_mut` ] : https://doc.rust-lang.org/stable/std/primitive.slice.html#method.rchunks_exact_mut
7979[ `RChunksExactMut::into_remainder` ] : https://doc.rust-lang.org/stable/std/slice/struct.RChunksExactMut.html#method.into_remainder
8080
81+ ## ` copied `
82+
83+ When iterating over collections of small data types, such as integers, it may
84+ be better to use ` iter().copied() ` instead of ` iter() ` . Whatever consumes that
85+ iterator will receive the integers by value instead of by reference, and LLVM
86+ may generate better code in that case.
87+ [ ** Example 1** ] ( https://github.com/rust-lang/rust/issues/106539 ) ,
88+ [ ** Example 2** ] ( https://github.com/rust-lang/rust/issues/113789 ) .
89+
90+ This is an advanced technique. You might need to check the generated machine
91+ code to be certain it is having an effect. See the [ Machine
92+ Code] ( machine-code.md ) chapter for details on how to do that.
You can’t perform that action at this time.
0 commit comments