3 ms·
"compiles super fast": compared to C++, sure. But not really, no.
by atilaneves 11y ago
"compiles super fast": compared to C++, sure. But not really, no.
- coliveira 11y agoC compilation is generally faster than C++ compilation for obvious reasons. However the true speed depends on the level of optimization you want and the number of header files you're including. Non-Optimized C code can be generated very quickly, and if you manage your header files conservatively you can have very fast compilation speeds.
- iainmerrick 11y agoCompiling stb_image, an incredibly useful image loader: $ wc -l stb_image.h 6433 stb_image.h $ more stb_image.c #define STBI_ONLY_JPEG #define STBI_ONLY_PNG #define STBI_FAILURE_USERMSG #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" $ time clang -c stb_image.c -o stb_image.o real 0m0.091s user 0m0.075s sys 0m0.014s Seems pretty fast to me!
- atilaneves 11y agoHave you ever written Pascal, Go, or D? That's what fast compilation looks like. The D standard library compiles in 3.5s from scratch.
- iainmerrick 11y agoYes, I've used Go. The compiler is fast and that's really nice; fast compilation was one of their explicit goals. Pascal and C are fast because they're old and relatively simple, and their implementations are mature. C++ becomes super slow when you start doing anything interesting, when I tried Rust it seemed very slow, even Java is slow although it seems like it shouldn't have to be. Those languages are all more widely used than D, I think. [edit: typo]
- deleted 11y ago[deleted]