The Dark Secrets of Fast Compilation for Kotlin
blog.jetbrains.com
The Dark Secrets of Fast Compilation for Kotlin
1–10 of 19 posts
Re: The Dark Secrets of Fast Compilation for Kotlin
#2I’m not knowledgeable enough to read between the lines, but is this a veiled reference to Go? If so, what about Go is intentionally not smart, and why? (Or language X)
Re: The Dark Secrets of Fast Compilation for Kotlin
#3> Now, you have a basic idea of the challenges that fast compilation in a modern programming language poses. Note that some languages deliberately chose to make their compilers not that smart to avoid having to do all this. I’m not knowledgeable enough to read between the lines, but is this a veiled reference to Go? If so, what about Go is intentionally not smart, and why? (Or language X)
The go language doesn't have either if those things, so the compiler has less work to do per line of code. But it seems like you knew that? You're the one that brought up Go.
Re: The Dark Secrets of Fast Compilation for Kotlin
#4> Now, you have a basic idea of the challenges that fast compilation in a modern programming language poses. Note that some languages deliberately chose to make their compilers not that smart to avoid having to do all this. I’m not knowledgeable enough to read between the lines, but is this a veiled reference to Go? If so, what about Go is intentionally not smart, and why? (Or language X)
See Rob Pike’s 2012 talk “Go at Google: Language Design in the Service of Software Engineering”
video + slides: https://www.infoq.com/presentations/Go-Google/
transcript: https://talks.golang.org/2012/splash.article#TOC_5.
Some of the things it calls out:
- unused dependencies are a compile-time error
- dependency graph has no cycles
- importing a package only looks at object files, not source files, so template/macro stuff is generally out
- declaration order is reverse from that of C so that parsing code is faster and easierRe: The Dark Secrets of Fast Compilation for Kotlin
#5> Now, you have a basic idea of the challenges that fast compilation in a modern programming language poses. Note that some languages deliberately chose to make their compilers not that smart to avoid having to do all this. I’m not knowledgeable enough to read between the lines, but is this a veiled reference to Go? If so, what about Go is intentionally not smart, and why? (Or language X)
Re: The Dark Secrets of Fast Compilation for Kotlin
#6Re: The Dark Secrets of Fast Compilation for Kotlin
#7> Now, you have a basic idea of the challenges that fast compilation in a modern programming language poses. Note that some languages deliberately chose to make their compilers not that smart to avoid having to do all this. I’m not knowledgeable enough to read between the lines, but is this a veiled reference to Go? If so, what about Go is intentionally not smart, and why? (Or language X)
I had a test suite that used `StringSpec` to make tests prettier to write, but after a few hundreds of those, my Kotlin tests started taking visibly longer to compile than the Java source code (which was much larger)! So I had to re-write the tests to use plain Kotlin functions instead.
All languages I know that have "advanced features" have notably slow compilers: Rust, Scala, Haskell. I would be happy to know if there's any counter-examples (I might almost include Kotlin as a counter-example, actually, as it's not so bad if you let it run the Gradle daemon to use the techniques mentioned in the article - but that feels a little bit like cheating as you're getting fast by just avoiding compiling everything).
So while I think the trade-off is worth it most of the time, it's something to be aware of and consider in your decision when choosing a language.
Re: The Dark Secrets of Fast Compilation for Kotlin
#8Seems less “dark secrets”, more “incremental compilation 101”
Re: The Dark Secrets of Fast Compilation for Kotlin
#9Lucid Energize did it: https://www.youtube.com/watch?v=pQQTScuApWk
Incomplete source code: https://archive.org/details/archiveteam-lucid-collection
Re: The Dark Secrets of Fast Compilation for Kotlin
#10> Now, you have a basic idea of the challenges that fast compilation in a modern programming language poses. Note that some languages deliberately chose to make their compilers not that smart to avoid having to do all this. I’m not knowledgeable enough to read between the lines, but is this a veiled reference to Go? If so, what about Go is intentionally not smart, and why? (Or language X)
I don't think they are referring to Go, a lot of languages avoid adding features that inevitably would add to compile times... Java for example (which I think is more likely what the author had in mind)... it requires you to end every statement with a semi-colon. Kotlin removes that restriction, but that costs compilation time (Kotlin seems to use a heuristic that if it's possible to terminate an expression when a ne…