Hacker News new | ask | show | jobs
by odersky 1258 days ago
This looks completely out of the ordinary. With a warm compiler, on a 4 year old Macbook Pro, I get 2000-4000 lines/sec. I.e. 4-8 seconds for your project. Unless you do some very involved typelevel or meta-programming stuff that's what you should expect to see.
1 comments

Yes my project does contain a bit of typelevel stuff (Cats Effect). And it's Scala 2.13, so not the latest 3.x which might compile a bit faster. Also to be fair, I was referring to the time taken by sbt compile, which I suppose does more than just invoking scalac. But still the time reported by sbt's Compile/ Compile incremental is over 200s.
to be fair, C+ header only libraries full of advanced template metaprogramming will also slow down compilation by a few order of magnitude.
I'm hopeful modules will come fast, they seem to fix that issue. Modules are already in C++20, but most compilers don't support them well enough yet.
I suspect they will help with the parsing, but not with template instantiation cost which dominates metaprogramming.
That is what external templates are for, pre-instantiate all common cases in a binary library.
I think 2.13 and 3.x are about par on compilation speed. sbt does add overhead, reportedly it can slow down compilation speed by half.
Martin?