Chapter 10. Efficiency of data structures
This chapter covers
- Optimizing and improving recursive functions
- Using tail-recursion and continuations
- Working efficiently with lists and arrays
So far in this book, we’ve used functional techniques such as recursion and functional data structures like immutable lists. We’ve written the code in the most straightforward way we could, using the basic F# collection type (a list) and expressing our intentions directly. This works very well in many situations, but when it comes to processing large data sets, “obvious” code sometimes leads to performance problems. In this chapter, we’ll look at techniques for writing code that work regardless of the size of the input and examine ways to optimize the performance ...