Fork to speedup build process?

Wonder if there’s some way to speedup the build process.
Like processing the code for all “libraries” first somehow, and then building the rest (the “changing stuff”) later?
I once used a library “spork”


that basically loaded “all of rails” then when it detected changes, loaded the “rails app itself” and ran the unit test, to speed things up (by forking and finishing the build). Just pondering if some “pre load warming” would be possible with crystal. I did some experiments and it seemed like a naive:

{% system("./wait_file.sh abc") %}

after requiring libraries didn’t help much time wise, so seems not possible that way. Just pondering…builds do already seem faster than they once were, so thank you to everyone who has contributed!

Cheers.

1 Like

Very nice idea. In my project, I have some requires like: “db”, “mysql”, “socket”, “json” and some others which I have no intention to ever modify unless doing a shard update. I wonder if there could be a system that only parses requires/files that were modified. If they weren’t, they don’t have to be parsed (this might speed up the compiler process).

Preface: I have no idea about compiler internals (just thinking out loud).

With that said, faster compiler times should be a way higher priority compared to some of the issues I’ve seen on GitHub, that’s for sure.

1 Like

I think it is somehow partially implemented, on macOS If you look into folder ~/.cache/crystal/* you can see similar files for each project you have. The size is different for the same files though.
But if we can extract those common files (.bc/,o) into common cache it can be reused then.