> I've found that in practice both `Code.ensure_loaded` and
`Code.ensure_compiled?` are both extremely slow in practice.

Yes, modules are atoms and the only way to know if an atom is actually a
module during development is if you check if there is a .beam file on disk.

If you want a quick check if something is a module, then you can use
is_atom. There is no way we can provide a performant is_module for
development.

In production, if you do releases, then this check is faster since modules
are loaded upfront.




*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*

On Mon, Feb 26, 2018 at 12:56 AM, <[email protected]> wrote:

> I've found that in practice both `Code.ensure_loaded` and
> `Code.ensure_compiled?` are both extremely slow in practice. Also it is not
> very intuitive that this is what you should be reaching for when attempting
> to check what type something is. The standard pattern that has been
> established is the "is_*" in the Kernel. I think we should continue that
> pattern with modules as well.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/9f1693ba-3d92-43e3-b48f-
> b92ec5e1cf8e%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/9f1693ba-3d92-43e3-b48f-b92ec5e1cf8e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KK6E2GB1CxW-_%3DGs0NKkAv6EJ%2B3vza8jtpny-KzuptbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to