Closed josevalim closed 10 years ago
Thanks a lot @josevalim , appreciate you taking the time to give feedback!
Was stoked to see the improvement here especially. :+1:
- stream = File.stream!(file)
- |> Stream.map fn line -> String.split(line, "\t") end
- # Attempted to 'fold' the stream into a map, but couldn't find the appropriate method.
- # Settled for Enum.to_list.
- map = List.foldl(Enum.to_list(stream), %{}, &Reducer.reduce_stream/2)
+ map =
+ File.stream!(file)
+ |> Stream.map(fn line -> String.split(line, "\t") end)
+ |> Enum.reduce(@dict, &reduce_stream/2)
@dimroc ah, i wanted to drop this comment. Stream, maps, lists are all Enumerables, so you can use all of the Enum functions (and Stream) to work with them.
Hello @dimroc!
I took the liberty of upgrading your project to Elixir 1.0.
Meanwhile I have noticed two things:
Those were very low hanging fruit optimizations and I was able to make the time down to 1m50s on an old macbook pro with 4 cores. If you plan to rerun your tests after this pull request, I would love to know your new results!