Content deleted Content added
Citation bot (talk | contribs) Altered date. Add: date, authors 1-1. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | Suggested by Abductive | #UCB_webform 3731/3850 |
Adamalpaca (talk | contribs) m If the second implementation is 1700 faster than the first at 2.8 microseconds, then the first implementation should be 4.76 ms not nanoseconds. There is no source on the result of the benchmark so there is no way for me to verify the values here, my correction is merely inferred from the text |
||
Line 228:
</syntaxhighlight>
has the mean execution time of 4.76
One distinguishing feature of [[Rust (programming language)|Rust]] are ''zero-cost abstractions''. This means that using them imposes no additional runtime overhead. This is achieved thanks to the compiler using [[loop unrolling]], where each iteration of a loop, be it imperative or using iterators, is converted into a standalone [[Assembly language|Assembly]] instruction, without the overhead of the loop controlling code. If an iterative operation writes to an array, the resulting array's elements [[Register allocation|will be stored in specific CPU registers]], allowing for [[Time complexity|constant-time access]] at runtime.<ref>{{Cite web |title=Comparing Performance: Loops vs. Iterators - The Rust Programming Language |url=https://doc.rust-lang.org/book/ch13-04-performance.html |access-date=2024-04-29 |website=doc.rust-lang.org}}</ref>
|