Forum > FPC development
[SOLVED] Poor optimization of constant folding
dsiders:
--- Quote from: 440bx on September 29, 2023, 08:00:38 am ---
--- Quote from: Leledumbo on September 29, 2023, 07:02:04 am ---The full source package indeed takes around that long even with a powerful CPU, a lot of fast RAM and NVMe SSD.
--- End quote ---
I've wondered for quite some time how long it takes to do a full build of Windows 10 or 11. That's 25 million+ lines of code, even on a really fast machine, it must be a rather "noticeable" amount of time.
--- End quote ---
I saw this some time ago:
> How long does it take to compile Windows?
>> Ales Holecek, vice president for development in Windows team said that it takes about 16 hours to build Windows 10.
>> And that it's built automatically every day during the night.
>> Oct 2008
marcov:
--- Quote from: Warfley on September 29, 2023, 12:13:25 am ---Compiling FPC with FPC takes a minute or so. Compiling GCC with GCC takes around 6 hours.
--- End quote ---
IIRC Sub minute for the whole FPC repo on a Ryzen 5700X on linux. A few seconds over a minute for windows.
But that includes RTL, packages and textmode IDE
p.s. my buildscript does skip the WPO optimization cycle.
440bx:
--- Quote from: dsiders on September 29, 2023, 08:26:59 am --->> Ales Holecek, vice president for development in Windows team said that it takes about 16 hours to build Windows 10.
>> And that it's built automatically every day during the night.
>> Oct 2008
--- End quote ---
Thanks dsiders.
16 hours... what a drag! I'm guessing that includes all the utilities, e.g, explorer.exe, IE/Edge, some of .net, etc, along with the O/S proper. IOW, everything that goes into "c:\windows" and possibly a few things that go into "c:\program files".
I guess he didn't mention the hardware specs.
dsiders:
--- Quote from: 440bx on September 29, 2023, 10:29:57 am ---
--- Quote from: dsiders on September 29, 2023, 08:26:59 am --->> Ales Holecek, vice president for development in Windows team said that it takes about 16 hours to build Windows 10.
>> And that it's built automatically every day during the night.
>> Oct 2008
--- End quote ---
Thanks dsiders.
16 hours... what a drag! I'm guessing that includes all the utilities, e.g, explorer.exe, IE/Edge, some of .net, etc, along with the O/S proper. IOW, everything that goes into "c:\windows" and possibly a few things that go into "c:\program files".
I guess he didn't mention the hardware specs.
--- End quote ---
That was the entire response. It's also the *only* response I've seen from a M$ employee.
Warfley:
C and C++ is very slow to compile full projects, which is why buildsystems like make only compile changed files and include the linker.
For example when I last worked on a large C++ project, compiling all the project including the whole dependency chains (which included building LLVM) would take 30 minutes on my PC with 32 gigs of RAM and a 1. gen threadripper. On my Macbook air at the time it would take multiple hours.
But once compiled only changed files need to be re-compiled, so as long as you don't touch the headers, everything compiles in a minute or so.
When people talk about the build times like MS with 16 hours, those are the nightly clean builds. Of course during development you will just compile deltas, and probably also always work on smaller tests rather than always building the full system.
That said, I know of some game companies that write games in C++, which always compile during their lunch breaks, to be able to test all the new features they built in the morning then later in the afternoon.
Some of this long compilation time is due to the C language design, e.g. the usage of header files means as soon as you change one byte of a header, you must recompile all files that include that header, while Pascal with it's unit and ppu system is much better optimized (I think since C++ got modules this should work similarly, but haven't used C++ for a while now). Thats why pretty much no other language uses the include file system from C but most go with a namespace/module system like Pascal Units.
But a very big factor is, as I said previously, simply that the C and C++ compilers do more stuff under the hood.
So yes, C compilers are very slow, but a big reason for this is, because they do a lot more things. Not all of those things the C compiler does make sense in all situations, e.g. I would argue that wasting whole hours of your day due to waiting compilation may not be worth some additional optimizations you get.
C is made for kernel development and C++ is used for things like browsers and low level applications. There you need all bit of optimization you can get. But honestly, I'm not sure if that is really worth it for pascal.
Many optimization problems are NP complete or even in non NP exp-time (well optimization as a concept in general are not even computable in the first place, only a few narrowly defined specific optimization patterns can be implemented), so there is no way to make them very fast. So not having them may be the better option when you aren't building time critical software
Navigation
[0] Message Index
[#] Next page
[*] Previous page