I didn’t use the -s
option much before, but when I tried it, I was impressed by the nice output.
However, the -s
option doesn’t show that most of the time is spent on two specific LLVM functions. These functions are each called only once. Most of the Crystal compilation time is spent on LLVM, and Crystal itself does very little.
This means speeding up the Crystal compiler might not reduce build time much. To improve build time, we might need to make LLVM faster or change how Crystal outputs LLVM-IR. For example, we could split it into parts for parallel compilation. But I’ve heard that splitting Crystal might cause type inconsistencies because the type number for each class changes with each compilation.
If you have been using Crystal for a long time, you probably know this. But newcomers often wonder why builds are so slow. Understanding that most of the time is spent on LLVM, not Crystal, will help them understand and feel comfortable.