3 ms·
> The compiler is slower than most mainstream language compilers Depends on which mainstream languages one compares with; there's always C++. My project here
by nh2 2y ago
> The compiler is slower than most mainstream language compilers
Depends on which mainstream languages one compares with; there's always C++.
My project here has 50k lines Haskell, 10k C++, 50k lines TypeScript (code-only, not comments). Counting user CPU time (1 core, Xeon E5-1650 v3 3.50GHz):
TypeScript 123 lines/s
Haskell 33 lines/s
C++ 7 lines/s
- Liquid_Fire 2y agoCan you clarify what "7 lines/s" means? Surely you are not saying that your 10k lines of C++ take more than 23 minutes to compile on a single core? Is it 10k lines of template spaghetti? For comparison, I just compiled a 25k line .cpp (probably upwards of 100k once you add all the headers it includes) from a large project, in 15s. Admittedly, on a slightly faster processor - let's call it 30s.
- nh2 2y agoIt means exactly that, 23 mins on a single core for 10k lines! (Insert "This is C++" Sparta image here.) It is quite clean application code but it _uses_ some of the most template heavy open-source libraries around (e.g. Eigen, CGAL, boost) -- all hallmarks of the strength of C++. If you look at other popular open-source C++ projects, such as Ceph or the Point Cloud Library (PCL), 8-hour single-core compile times are, unfortuanately, normal. I fully agree that C++ code bases that are more C-like compile much faster. But many typical C++ projects that use standard C++ features compile at 7 lines per second. The same holds for Haskell: If you write very simple code and do not use common functionality (TemplateHaskell, Generics deriving), you'll also get a 20x compile time speedup.