Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Lazy evaluation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Performance== The number of beta reductions to reduce a lambda term with call-by-need is no larger than the number needed by call-by-value or [[call-by-name]] reduction.<ref>{{cite book |last1=Niehren |first1=Joachim |title=Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages - POPL '96 |chapter=Functional computation as concurrent computation |date=1996 |pages=333β343 |doi=10.1145/237721.237801 |isbn=0897917693 |s2cid=7332050 |url=https://hal.inria.fr/inria-00536819/file/POPL96.pdf |chapter-url=https://publikationen.sulb.uni-saarland.de/bitstream/20.500.11880/25024/1/RR_95_14.pdf}}</ref><ref>{{cite journal |last1=Niehren |first1=Joachim |title=Uniform confluence in concurrent computation |journal=Journal of Functional Programming |date=September 2000 |volume=10 |issue=5 |pages=453β499 |doi=10.1017/S0956796800003762 |s2cid=66013 |url=https://hal.inria.fr/inria-00536801/document |access-date=7 January 2022}}</ref> And with certain programs the number of steps may be much smaller, for example a specific family of lambda terms using [[Church numeral]]s take an infinite amount of steps with call-by-value (i.e. never complete), an exponential number of steps with call-by-name, but only a polynomial number with call-by-need. Call-by-need embodies two optimizations - never repeat work (similar to call-by-value), and never perform unnecessary work (similar to call-by-name).<ref name=Stelle>{{cite thesis |last1=Stelle |first1=George Widgery |title=Shared-Environment Call-by-Need |date=July 2019 |url=https://digitalrepository.unm.edu/cgi/viewcontent.cgi?article=1099&context=cs_etds#page=23 |access-date=8 January 2022|publisher=University of New Mexico|type=PhD|pages=11β12}}</ref> Lazy evaluation can also lead to reduction in [[memory footprint]], since values are created when needed.<ref name="Smith2009">{{cite book|author=Chris Smith|title=Programming F#|url=https://books.google.com/books?id=gzVdyw2WoXMC&pg=PA79|access-date=31 December 2010|date=22 October 2009|publisher=O'Reilly Media, Inc.|isbn=978-0-596-15364-9|page=79}}</ref> In practice, lazy evaluation may cause significant performance issues compared to eager evaluation. For example, on modern computer architectures, delaying a computation and performing it later is slower than performing it immediately. This can be alleviated through [[strictness analysis]].<ref name=Stelle/> Lazy evaluation can also introduce [[memory leak]]s due to unevaluated expressions.{{sfn|Launchbury|1993}}<ref>Edward Z. Yang. [http://blog.ezyang.com/2011/05/space-leak-zoo/ "Space leak zoo"].</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)