Improve Performance with Streams
Learn how streams reduce the time taken by the open_airports() function.
We'll cover the following...
Streams
We know that the Stream
data structure is lazily evaluated and allows us to process data only when needed. The Stream
module has lazy implementations of map/2
, filter/2
, and other functions. We can use Stream.map/2
and Stream.filter/2
to replace their Enum
counterparts, but what about reading and parsing the file?
Use File.stream!
Don’t worry, Elixir has us ...