Skip to content

Commit 6e66639

Browse files
committed
move edge properties to field to prevent perf regressions
1 parent 8381eaf commit 6e66639

6 files changed

Lines changed: 228 additions & 151 deletions

File tree

lib/edge.ex

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ defmodule Graph.Edge do
6363
def options_to_meta(opts) when is_list(opts) do
6464
label = Keyword.get(opts, :label)
6565
weight = Keyword.get(opts, :weight, 1)
66-
properties = Keyword.get(opts, :properties, %{})
6766

68-
case {label, %{weight: weight, properties: properties}} do
69-
{label, %{weight: w} = meta} when is_number(w) ->
70-
{label, meta}
67+
case {label, weight} do
68+
{_, w} = meta when is_number(w) ->
69+
meta
7170

72-
_other ->
71+
{_, _} ->
7372
raise ArgumentError, message: "invalid value for :weight, must be an integer"
7473
end
7574
end

0 commit comments

Comments
 (0)