From someone stuck with dynamic languages, mark my words, it's best for your compiler to be a bit slow, than your brain being the compiler! :-)
From someone stuck with dynamic languages, mark my words, it's best for your compiler to be a bit slow, than your brain being the compiler! :-)
Take Delphi for example: statically typed, strong type correctness, you have to work to avoid type safety. Compiles a million lines of code in 4 seconds (including linking.)
* https://www.youtube.com/watch?v=Yq2mNUzcpE0 (1 million lines, 4 seconds)
* https://www.youtube.com/watch?v=kvuxeaMDmMc (277,000 lines of much more complex code (the most complex, compiler-stressing library Delphi has) in 16 seconds counting linking.
And I am not making this up, it is how Eiffel, Lisp, JVM, .NET and Swift (from what I could gather in WWDC presentations) toolchains work.
Also how long gone C++ toolchains like Lucid C++ and IBM Visual Age for C++ (only the v4.0) used to work.
Even Microsoft is going this route for C++ on the upcoming VS "15", with the help of new linker and the experimental modules support.
https://blogs.msdn.microsoft.com/vcblog/2016/10/05/faster-c-...
Was it always an explicit goal of theirs compilation speed? Is there any documentation of specific things they did to achieve that build speed?
Compiler designed for compilation speed above all else. Delphi did not attempt to ever compete with other languages/toolchains on raw runtime performance of the generated code .... I don't recall ever seeing Borland/Inprise boast that a new version generated more optimal code. This is because the code the compiler produced was fast enough for Delphi's target market (desktop business apps) and it was still a lot faster than Visual Basic, and a lot more compact than Java, which were its primary competitors. Delphi sold new versions to developers by giving them new productivity tools: for desktop apps that spend all their time idling, raw code performance was rarely an issue.
Single pass compiler. Structuring Delphi apps could be a nightmare. You could not have circular unit dependencies and breaking such dependencies could often be irritating as hell. Functions had to be declared in the right order.
No preprocessor or include based model. "Units" defined their header and implementation in the same file, so the compiler could rapidly load a binary representation of what a unit exported whilst it was compiling.
No generics. Thus, no explosion of code to generate at runtime, like with C++.
Grammar that was very easy to parse.
Compiler codebase that at its core was designed for very old computers, so is/was very tightly written.
Probably more. That's just what I recall.
I never wrote Delphi myself, but I always appreciated it, because it was used to develop the first IDE I used fory first programming class. Bloodshed's Dev C++. Quite an impressive IDE, so I imagine Delphi was (still is? No idea) a great platform for desktop app development.
Nowadays most of them are enterprise customers with big maintenance contracts.
Also for shops focusing on Windows only customers, Delphi cannot compete with .NET.
Hence why many of us, Wirth fans, enjoy but aren't that much impressed by Go compilation speed novelty.
Still it is good that they do pursue this goal, for newer generations not to assume C and C++ compilation speeds are normal and to be expected.
Also C++ compilation can improve when moving away from its #include model. When VC++ "15" gets release we will get an improved linker with DB support and experimental module support.
It's also not competitive speed-wise with either clang/gcc OR rust.
That is a funny one....
* Waiting patiently for my JDK9 JShell
OCaml installations tend to come with both a native compiler and a byte-code compiler/runtime, so you really get the best of both worlds there - minus some occasional hiccups in the build process.
Indeed the core loop becomes edit-typecheck, and while the compiler can be slow, the type checker tends to be a lot faster than the test suite.
lol, I'm on a project right now that uses ES2016 (dynamic) and I'm still stuck on a slow compiler.
class A {
constructor() {
this.handle = setInterval(/* blah */, 1000);
}
clearInterval() {
clearInterval(this.handle);
}
}
Becomes: function A() {
this.handle = setInterval(/* blah */, 1000);
}
A.prototype.clearInterval = function clearInterval() {
clearInterval(this.handle);
};
And if you're switching from babel to buble, you'll be confused as to why you're suddenly getting a bunch of stack overflow errors.I have a fairly large project and don't see a significant difference in compile times between the two. Slowness in my build process usually means I've accidentally touched the node_modules directory in my gulp.src expression. It's not enough to use a negation! You have to avoid testing it completely.
> let foo = function bar() {}
undefined
> bar
ReferenceError: bar is not definedhttps://buble.surge.sh/#class%20A%20%7B%0A%20%20clearInterva...
with
https://babeljs.io/repl/#?babili=false&evaluate=true&lineWra...
Even if you're not targeting modern browsers, you might consider developing on Chrome with a very minimal, modules-only Babel config, and then running the full transform only when you're ready to QA & deploy.
For me, the sweet spot would be the compilation speed of Delphi, .NET Native and similar languages.