-
Notifications
You must be signed in to change notification settings - Fork 463
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
I know the use of meta-programming is fun. But the BEAM doesn't handle loading thousands of modules very well. We have several Google libraries in our deployment Elixir and just loading Google API libraries takes over a minute!!! OVER A MINUTE for a few APIs!!!!
iex -S mix run --no-start
fn ->
times =
Application.loaded_applications()
|> Enum.map(fn {app, _desc, _vsn} ->
modules = Application.spec(app, :modules)
{time, _result} = :timer.tc(fn -> Enum.each(modules, &Code.ensure_loaded!/1) end)
{app, System.convert_time_unit(time, :microsecond, :millisecond)}
end)
|> Enum.sort_by(&elem(&1, 1), :asc)
Enum.each(times, &IO.inspect/1)
times |> Enum.map(&elem(&1, 1)) |> Enum.sum() |> IO.inspect()
end.()# {application, time_in_ms}
...
{:google_api_you_tube, 6336}
{:google_api_dfa_reporting, 11710}
{:google_api_vision, 15091}
{:google_api_content, 29394}
michallepicki, artofhuman, Adzz and jarrodmoldrich
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.