5 ms·
The gold standard for compiler speed so far is TCC. (Fabrice Bellard) It is not even super optimized (single thread, no fancy tricks) but it is so far unbeaten
by stephc_int13 1y ago
The gold standard for compiler speed so far is TCC. (Fabrice Bellard)
It is not even super optimized (single thread, no fancy tricks) but it is so far unbeaten by a large margin. Of course I use Clang for releases, but the codegen of tcc is not even awful.
- Rochus 1y agoThe Go compiler is also pretty fast.
- klysm 1y agoMaybe typescript will catch up
- satvikpendem 1y agoIt's being rewritten in Go so yes it will
- serial_dev 1y agoThe compiler might be rewritten in Go, but the Typescript and Go languages themselves are very different. Go’s main objectives were fast builds and a simple language. Typescript is tacked onto another language that doesn’t really care about TS with three decades of warts, cruft and hacks thrown together.
- veber-alex 1y agoIt's hard to say. One the one hand the go type system is a joke compared to typescript so the typescript compiler has a much harder job of type checking. On the other hand once type checking is done typescript just needs to strip the types and it's done while go needs to optimize and generate assembly.
- levodelellis 1y agoI'd call it not terribly slow. IIRC it didn't hit 100k lines on an M2, while I saw over two million on my own compiler (I used multiple instances of tcc since I didn't want to deal with implementing debug info on mac)
- c0balt 1y agoWhat specifically are those 100k lines though? Golang code that, e. G., uses generics is significantly heavier than code that doesn't.
- levodelellis 1y agoI don't remember, I grabbed a project that I can't remember the name of and compiled something else first to warm up the compiler then compile the project. I tried several times and it seemed to be consistently < 100K
- burnt-resistor 1y agoThere is no singular "gold standard". vlang is really fast, recompiling itself entirely within a couple of seconds. And Go's compiler is pretty fast for what it does too. No one platform has a unique monopoly on build efficiency. And also there are build caching tools and techniques that obviate the need for recompliation altogether.
- von_lohengramm 1y ago> vlang is really fast, recompiling itself entirely within a couple of seconds. Does V still just output C and use TCC under the hood?
- shakna 1y agoYes. [0] https://github.com/vlang/v/blob/master/Makefile#L18 https://github.com/vlang/v/blob/master/Makefile#L18
- giancarlostoro 1y agoSo in theory, I can make Nim do the same?
- cb321 1y agoI use tcc with Nim all the time and it yields almost interpreted REPL-like code-iteration speed (like 100-500ms per compile-link - almost ENTER-see-results). As a warning, you need to be sure --lineDir=off in your nim.cfg or config.nims (to side-step the infinite loop mentioned in https://github.com/nim-lang/Nim/pull/23488 https://github.com/nim-lang/Nim/pull/23488). You may also need to --tlsEmulation=on if you do threads and you may want to --passL=-lm. tcc itself is quite fast. Faster for me than a Perl5 interpreter start-up for me (with both on trivial files). E.g., on an i7-1370P: tim "tcc -run /t/true.c" "/bin/perl</n" 58.7 +- 1.3 μs (AlreadySubtracted)Overhead 437 +- 14 μs tcc -run /t/true.c 589 +- 10 μs /bin/perl</n { EDIT: /n -> /dev/null and true.c is just "int main(int ac,char*av){return 0;}". }
- 1y ago
- teo_zero 1y ago> The gold standard for compiler speed so far is TCC. I only wish it supported C23...
- oguz-ismail 1y agoAny big projects that doesn't compile without C23 support?
- flohofwoe 1y agoNot yet AFAIK, but unlike the 'inbetween' versions since C99, C23 actually has a number of really useful features, so I expect that a couple of projects will start using C23 features. The main problem is as always MSVC, but then maybe its time to ditch MSVC support since Microsoft also seems to have abandondend it (not just the C compiler, but also the C++ compiler isn't seeing lots of updates since everybody working on Visual Studio seems to have been reassigned to work in the AI salt mines).
- pjmlp 1y agoAnd Rust, as the official system programming language for Azure. However there are several C++23 goodies on latest VC++, finally. Also lets not forget Apple and Google no longer are that invested into clang, rather LLVM. It is up for others to bring clang up to date regarding ISO.
- flohofwoe 1y agoClang's support for C23 looks actually pretty good: https://en.cppreference.com/w/c/compiler_support/23.html https://en.cppreference.com/w/c/compiler_support/23.html (not sure how much Apple/Google even cared about the C frontend before though, but at least keeping the C frontend and stdlib uptodate by far doesn't require as much effort as C++).
- pjmlp 1y agoApple used to care before Swift, because Objective-C unlike C++, is a full superset from C. Most of the work going into LLVM ecosystem is directly into LLVM tooling itself, clang was started by Apple, and Google picked up on it. Nowadays they aren't as interested, given Swift, C++ on Apple platforms is mostly for MSL (C++14 baseline) and driver frameworks (also a C++ subset), Google went their own way after the ABI drama, and they care about what fits into their C++ style guide. I know Intel is one of the companies that picked up some of the work, yet other compiler vendors that replaced their proprietary forks with clang don't seem that eager to contribute upstream, other than LLVM backends for their platforms. Such is the wonders of Apache 2.0 license.
- brabel 1y agoI thought DMD which compiles both C and D was the gold standard!?
- pjmlp 1y agoI would rather vouch for Delphi, as a much more expressive, and safer language, while having blazing fast compile times.
- pkphilip 1y agoTrue. Incremental compilation in Delphi is quite something else.
- levodelellis 1y agoYes. I once was thinking I should write a x86-64 codegen for my own compiler, but using tcc I was able to reach 3 million lines in a second (using multi-threading and multiple instances of tcc) so I called it a day. I never did check out if the linking was in parallel