Absinthe experienced non linear compilation time that made having a huge number of functions impossible. However, that version of Absinthe also had a lot more going on in the module body than just defining functions, and this seemed to have a large effect on compilation time.
Doing:
:observer.start()
defmodule PocManyClauses do
@list 1..10_000_000 |> Enum.map(fn n -> :"fn_#{n}" end)
Enum.map(@list, fn n ->
def unquote(n)(), do: unquote(n)
end)
end
and then compiling via elixir --erl "+t 20000000" huge.ex
indicates you also will run into a memory problem:
Notably, compilation does not seem to be generating atoms, as the atom count remains steady.
In any case, generating hard coded modules as a lookup table has its uses, but for your situation (Complexity of a search withing a range in a ets? - #9 by benwilson512) it feels like a proper data structure or data storage engine (ets) will be better.