Commit 90613b4b authored by minibikini's avatar minibikini

Merge branch 'improve-performance' into 'master'

Improve TLD lookup performance

See merge request pleroma/auto_linker!13
parents fea7b9ea 275fb906
Pipeline #10255 passed with stages
in 1 minute and 31 seconds
...@@ -40,7 +40,7 @@ defmodule AutoLinker.Parser do ...@@ -40,7 +40,7 @@ defmodule AutoLinker.Parser do
"ssb://" "ssb://"
] ]
@tlds "./priv/tlds.txt" |> File.read!() |> String.split("\n", trim: true) @tlds "./priv/tlds.txt" |> File.read!() |> String.split("\n", trim: true) |> MapSet.new()
@default_opts ~w(url)a @default_opts ~w(url)a
...@@ -344,8 +344,7 @@ defmodule AutoLinker.Parser do ...@@ -344,8 +344,7 @@ defmodule AutoLinker.Parser do
true true
else else
tld = host |> String.split(".") |> List.last() tld = host |> String.split(".") |> List.last()
MapSet.member?(@tlds, tld)
Enum.member?(@tlds, tld)
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment