Skip to content

Commit

Permalink
Remove ParallelStream
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljaouen committed Apr 15, 2024
1 parent 171bca9 commit ec463a0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ $ mix test
## LFE version
[Here.](https://github.com/danieljaouen/dynamic-programming-in-lfe)

Note: The Elixir version is currently more performant due to parallel processing.

Edit: Maybe not. Looks like ParalleStream adds a significant overhead. Check
your results with `:timer.tc(fn -> lowest_cose_path(...) end)` first and
perhaps modify your version of the code to not use ParallelStream.

## License

Apache License, Version 2.0
Expand Down
2 changes: 1 addition & 1 deletion lib/dynamic_programming_in_elixir.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule DynamicProgrammingInElixir do
{:error, "Cannot reach source from current path"}
else
in_edges
|> ParallelStream.map(fn edge -> calculate_current_path(g, source, edge) end)
|> Enum.map(fn edge -> calculate_current_path(g, source, edge) end)
|> Enum.filter(fn x -> elem(x, 0) == :ok end)
|> Enum.to_list()
|> my_min()
Expand Down

0 comments on commit ec463a0

Please sign in to comment.