What are the technical reasons for Crystal's relatively slow compilation speed?

Hi.

I really like Crystal and had a few questions.

  1. Are the major contributors to compilation times known ?

  2. What’s the typical analysis process that core contributors use to discern these contributors ? (Profilers ? Built-in trace etc ?)

  3. Is type inference a significant contributor ? If so, can explicit type annotation be some kind of modal work-around ? (as in: a compile time switch that tells the compiler to not do inference at all and bail out when needed)

  4. Is there scope for other such modal workarounds in the interest of faster compile times ?

  5. I think I heard that optimising for compile times is somehow going to impact Crystal’s expressiveness. Is that true ? If so, could someone explain ?

Many thanks!

Related: Incremental compilation exploration

1 Like

Compile with the --stats flag and see for yourself what it is that take time. But generally sepaking, in development mode it is the type checking that is the main cost, while in release mode it will be code generation and optimization.

4 Likes