5 ms·
I remember Pascal compiling crazy fast compared to C/C++. Partly because the language was designed to be easy to parse, but I assume part of the speed came at t
by klipt 5y ago
I remember Pascal compiling crazy fast compared to C/C++. Partly because the language was designed to be easy to parse, but I assume part of the speed came at the cost of producing less optimal code.
But if most of your compiles are during development and debugging where optimization is less important, wouldn't it be nice to have super fast compilation during those stages? I don't know if any other compiled language comes close to Pascal in that regard.
- deaddabe 5y agoFrom my experience C is very fast to compile. Especially compared to C++, because of the metaprogramming and monomorphization stuff. In C you would use void*. Dynamic dispatch is faster to compile than static dispatch, but runtime performance differs. You can do dynamic dispatch in Rust, I think it could enable faster/smaller builds but at the cost of worst runtime performance. Tradeoffs, Yada Yada.
- pjmlp 5y agoOn our C projects back in the 2000's, a full build took around one hour, composed of Apache, IIS ISAPI modules, our own mod_tcl fork, all the TCL database drivers for MS SQL Server, Sybase SQL Server, Informix, Oracle, and several other native modules. Then we had to repeat it for HP-UX, Aix, Solaris, Windows NT/2000, in release and debug variants. A release would be a day event, so fast to compile is relative.
- cb321 5y agoWhile I agree the common pattern is to use void*/dynamic dispatch, this is not necessary. E.g., https://github.com/glouw/ctl/ https://github.com/glouw/ctl/ or https://github.com/c-blake/bst https://github.com/c-blake/bst show a couple ways to have generic code statically specialized in regular old C. (Instantiation/specialization is just marginally less automatic/syntactically supported.)
- the8472 5y agoA faster codegen backend for debug builds is in the works. https://github.com/bjorn3/rustc_codegen_cranelift https://github.com/bjorn3/rustc_codegen_cranelift
- aitchnyu 5y agoWill it allow incorrect code like an interpreter? I edit one controller/view in Django, print something and let it crash. Then I fix it and (hopefully) correct the rest of the controllers.
- kibwen 5y agoAll languages allow incorrect code that crashes. Perhaps you're referring to compiler-aided refactoring (make a change, compile, inspect the errors, correct, repeat), which yes, Rust is very good at, as are most statically-typed languages.
- cb321 5y agohttps://en.wikipedia.org/wiki/Tiny_C_Compiler https://en.wikipedia.org/wiki/Tiny_C_Compiler probably compiles as fast or faster than the Pascal you remember. You can even use it as a backend for the Nim (https://nim-lang.org/ https://nim-lang.org/ ) compiler for subsecond builds of a modern language with various choices for automatic memory management.
- ptman 5y agoA big part was that pascal had a decent module system, while C only has includes. The same header files can be included from multiple places and have to be processed multiple times. IIRC the Plan9 C compiler had some restrictions (or maybe just conventions) to prevent this. Also, Borland Pascal / Delphi compilers weren't terrible at optimizing. And they often produced smaller executables.
- icholy 5y ago> I don't know if any other compiled language comes close to Pascal in that regard. Go and D are pretty comparable.