logo

auto_linker

AutoLinker-shim, based on https://git.pleroma.social/pleroma/auto_linker
commit: 90613b4bae875a3610c275b7056b61ffdd53210d
parent: fea7b9ea694160a3bc377f667521c521bae55cdd
Author: Egor <egor@kislitsyn.com>
Date:   Tue,  9 Apr 2019 12:02:29 +0000

Merge branch 'improve-performance' into 'master'

Improve TLD lookup performance

See merge request pleroma/auto_linker!13

Diffstat:

Mlib/auto_linker/parser.ex5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/auto_linker/parser.ex b/lib/auto_linker/parser.ex @@ -40,7 +40,7 @@ defmodule AutoLinker.Parser do "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 @@ -344,8 +344,7 @@ defmodule AutoLinker.Parser do true else tld = host |> String.split(".") |> List.last() - - Enum.member?(@tlds, tld) + MapSet.member?(@tlds, tld) end end