Content deleted Content added
→Performance: Thanks for the edits! Agree with all other edits but this information about Haskell does not really add to the article - doesn't belong in this section, the source is a blog post, and the summary text "many, varied relative strengths and limits effecting programming and performance" does not really say anything. |
Jerryobject (talk | contribs) m WP:REFerence WP:CITation parameters update-standardize: reorder. |
||
Line 629:
== Performance ==
Since it performs no garbage collection, Rust is often faster than other memory-safe languages.<ref>{{Cite web |last1=Anderson |first1=Tim |date=2021-11-30 |title=Can Rust save the planet? Why, and why not |url=https://www.theregister.com/2021/11/30/aws_reinvent_rust/ |access-date=2022-07-11 |website=[[The Register]] |language=en |
Rust provides two "modes": safe and unsafe. Safe mode is the "normal" one, in which most Rust is written. In unsafe mode, the developer is responsible for the code's memory safety, which is used by developers for cases where the compiler is too restrictive.<ref name="UnsafeRustUse">{{Cite journal |last1=Astrauskas |first1=Vytautas |last2=Matheja |first2=Christoph |last3=Poli |first3=Federico |last4=Müller |first4=Peter |last5=Summers |first5=Alexander J. |date=2020-11-13 |title=How do programmers use unsafe rust? |url=https://dl.acm.org/doi/10.1145/3428204 |journal=Proceedings of the ACM on Programming Languages |language=en |volume=4 |issue=OOPSLA |pages=1–27 |doi=10.1145/3428204 |issn=2475-1421|hdl=20.500.11850/465785 |hdl-access=free}}</ref>
Line 635:
Many of Rust's features are so-called ''zero-cost abstractions'', meaning they are optimized away at compile time and incur no runtime penalty.{{sfn|McNamara|2021|p=19, 27}} The ownership and borrowing system permits [[zero-copy]] implementations for some performance-sensitive tasks, such as [[parsing]].<ref>{{Cite book |last=Couprie |first=Geoffroy |title=2015 IEEE Security and Privacy Workshops |chapter=Nom, A Byte oriented, streaming, Zero copy, Parser Combinators Library in Rust |date=2015 |pages=142–148 |doi=10.1109/SPW.2015.31 |isbn=978-1-4799-9933-0 |s2cid=16608844 }}</ref> [[Static dispatch]] is used by default to eliminate [[method call]]s, except for methods called on dynamic trait objects.{{sfn|McNamara|2021|p=20}} The compiler also uses [[inline expansion]] to eliminate [[function call]]s and statically-dispatched method invocations.<ref>{{Cite web |title=Code generation |url=https://doc.rust-lang.org/reference/attributes/codegen.html |access-date=2022-10-09 |website=The Rust Reference |archive-date=2022-10-09 |archive-url=https://web.archive.org/web/20221009202615/https://doc.rust-lang.org/reference/attributes/codegen.html |url-status=live}}</ref>
Since Rust uses [[LLVM]], all performance improvements in LLVM apply to Rust also.<ref name="how-fast-is-rust">{{cite web |url=https://doc.rust-lang.org/1.0.0/complement-lang-faq.html#how-fast-is-rust? |title=How Fast Is Rust? |website=The Rust Programming Language FAQ |access-date=11 April 2019 |archive-date=28 October 2020 |archive-url=https://web.archive.org/web/20201028102013/https://doc.rust-lang.org/1.0.0/complement-lang-faq.html#how-fast-is-rust? |url-status=live}}</ref> Unlike C and C++, Rust allows for reordering struct and enum elements<ref>{{Cite book |last1=Farshin |first1=Alireza |last2=Barbette |first2=Tom |last3=Roozbeh |first3=Amir |last4=Maguire |first4=Gerald Q. Jr |last5=Kostić |first5=Dejan |year=2021 |url=https://dlnext.acm.org/doi/abs/10.1145/3445814.3446724 |access-date=2022-07-12 |language=en |doi=10.1145/3445814.3446724
== Adoption ==
|