Comparison between lazy and strict evaluation
Song, Nayeong (2020)
Song, Nayeong
2020
Bachelor's Programme in Science and Engineering
Informaatioteknologian ja viestinnän tiedekunta - Faculty of Information Technology and Communication Sciences
This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Hyväksymispäivämäärä
2020-10-20
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:tuni-202010277532
https://urn.fi/URN:NBN:fi:tuni-202010277532
Tiivistelmä
Evaluation strategy is the way to define the order of function call’s argument’s evaluation. Most of today’s programming languages employ a strict programming paradigm, which is focused mostly on call-by-value and call-by-reference. However, call-by-name or call-by-need, which evaluates the expression lazily, is used only in functional programming languages and those are rather unfamiliar to these day’s programmers.
This thesis focuses on the comparison between different evaluation techniques but mostly focused on strict evaluation and lazy evaluation. First, the theoretical difference is presented in the mathematical aspect in lambda calculus, and the practical examples are presented in Python and Haskell.
The results show that a program can benefit from lazy evaluation when evaluating non-terminable expressions or optimize the performance when the values are cached. However, in case the function has side effects, lazy evaluation cannot be used together and it makes it harder to predict the memory usage compared to strict evaluation.
This thesis focuses on the comparison between different evaluation techniques but mostly focused on strict evaluation and lazy evaluation. First, the theoretical difference is presented in the mathematical aspect in lambda calculus, and the practical examples are presented in Python and Haskell.
The results show that a program can benefit from lazy evaluation when evaluating non-terminable expressions or optimize the performance when the values are cached. However, in case the function has side effects, lazy evaluation cannot be used together and it makes it harder to predict the memory usage compared to strict evaluation.
Kokoelmat
- Kandidaatintutkielmat [8918]