Skip to content

Commit b8a29e0

Browse files
committed
Use :erlang.phash2 with tuples as it is much faster
1 parent ab5b33d commit b8a29e0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/elixir/lib/module/types/descr.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ defmodule Module.Types.Descr do
4848
# Remark: those are explicit BDD constructors. The functional constructors are `bdd_new/1` and `bdd_new/3`.
4949
@fun_top {:negation, %{}}
5050
@atom_top {:negation, :sets.new(version: 2)}
51-
@map_top {:erlang.phash2([:open | @fields_new]), :open, @fields_new}
52-
@non_empty_list_top {:erlang.phash2([:term | :term]), :term, :term}
53-
@tuple_top {:erlang.phash2([:open | []]), :open, []}
54-
@map_empty {:erlang.phash2([:closed | @fields_new]), :closed, @fields_new}
51+
@map_top {:erlang.phash2({:open, @fields_new}), :open, @fields_new}
52+
@non_empty_list_top {:erlang.phash2({:term, :term}), :term, :term}
53+
@tuple_top {:erlang.phash2({:open, []}), :open, []}
54+
@map_empty {:erlang.phash2({:closed, @fields_new}), :closed, @fields_new}
5555

5656
defmacrop bdd_leaf(arg1, arg2) do
5757
quote do
@@ -5782,7 +5782,7 @@ defmodule Module.Types.Descr do
57825782

57835783
## BDD helpers
57845784

5785-
defp bdd_leaf_new(arg1, arg2), do: {:erlang.phash2([arg1 | arg2]), arg1, arg2}
5785+
defp bdd_leaf_new(arg1, arg2), do: {:erlang.phash2({arg1, arg2}), arg1, arg2}
57865786

57875787
defp bdd_node_new(lit, c, u, d),
57885788
do: {bdd_compute_hash(lit, c, u, d), lit, c, u, d}

0 commit comments

Comments
 (0)