nico
August 22, 2021, 9:14am
1
Hello,
Please, some tips to reduce compilation time during development?
The bigger a project gets, the longer it takes to save each file => compile => see the result.
It’s normal, but very long. For example, during development, I have one project in Crystal that takes about 20 seconds to compile and another (smaller) project 10 seconds.
Any tip is welcome
vlazar
August 22, 2021, 12:49pm
2
Keep an eye on crystal i by asterite · Pull Request #10910 · crystal-lang/crystal · GitHub
It’s not released yet, but looks very promising in regards to fast feedback loop during development.
1 Like
20 seconds sounds like a lot. How many LoC and shards do you have in your project?
nico
August 24, 2021, 3:56am
4
Indeed
A complement of that Why is Crystal language faster than Ruby language? - #4 by nico
Yes, it’s a productivity killer. I migrate the project 1 which is in early stage.
Project 2 is too advanced so we continue as is for now.
Project 1
Time to compil (dev): about 10 seconds
LoC: 1519 lines
Lib directory: 39 shards (LoC: 105345 lines)
Project 2
Time to compil (dev): about 20 seconds
LoC: 13264 lines
Lib directory: 26 shards (LoC: 74058 lines)
vlazar
August 27, 2021, 11:12am
5
Since the second project has about the same LoC but takes 2x as much time to compile, I wonder if maybe there are some big arrays/hashes in code?
There is an issue and an easy workaround if that’s the case Extremely slow compilation and high ram usage for large Arrays and Hashes · Issue #5792 · crystal-lang/crystal · GitHub
nico
September 6, 2021, 3:40pm
6
I don’t have a big array to populate but it’s something to consider, thanks