Skip to content

Commit e1907ea

Browse files
committed
Add warning on OTP28.0
1 parent 602096f commit e1907ea

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/elixir/lib/regex.ex

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,17 @@ defmodule Regex do
10251025
# OTP 28.0 works in degraded mode performance-wise, we need to recompile from the source
10261026
true ->
10271027
quote do
1028+
IO.warn_once(
1029+
{Regex, :__escape__},
1030+
fn ->
1031+
"""
1032+
Regexes will be re-compiled from source at runtime, which will cause degraded performance.
1033+
This can be fixed by using Erlang OTP 28.1+ or 27-.
1034+
"""
1035+
end,
1036+
3
1037+
)
1038+
10281039
{:ok, pattern} =
10291040
:re.compile(unquote(Macro.escape(regex.source)), unquote(Macro.escape(regex.opts)))
10301041

0 commit comments

Comments
 (0)