5 ms·
[Not "real" C++ code, benchmark is for compiling 14492754 copies of a fairly simple C function]
by formerly_proven 6y ago
[Not "real" C++ code, benchmark is for compiling 14492754 copies of a fairly simple C function]
- jandrese 6y agoSeems like he tried more complex examples too, but ran into roadblocks like a 2GB limit on executables and running into a commandline length limit restriction that dates back to early DOS days which made it impossible to link. Both of those problems seemed solvable if he was willing to chunk up his application into libraries, maybe 1024 files per library then linked to the main application.
- simcop2387 6y agoI believe this is one of the reasons for object libraries (or archives, the foo.a files on linux/unix), you can then link in all of the object files from one of those at link time without having to list them all at once. That won't get past the 2GB limit on executables but it will get past the command line length.
- jandrese 6y agoI was going to suggest that, but he's running on Windows and I don't know if they are supported there. I guess they probably are since they're a compiler feature.
- com2kid 6y agoThis is correct, a .lib file on Windows has a bunch of .obj files in it that you can then link together. You can also use command files[1] to pass options in instead of using the command line. [1] https://docs.microsoft.com/en-us/cpp/build/reference/linking?view=msvc-160 https://docs.microsoft.com/en-us/cpp/build/reference/linking... to pass
- deleted 6y ago[deleted]
- fmxexpress 6y agoI searched for an option for make to do a command line file like this but didn't see one so struck out.
- account42 6y ago> a commandline length limit restriction that dates back to early DOS days which made it impossible to link. MinGW's linker supports passing the list of objects as a file for this reason and CMake will use that by default.
- jpaul23 6y agoDoes there exist some kind of random C code generator?
- blt 6y agoYeah, I would say this title is a little misleading. The example doesn't use any of the C++ features that cause long compile times, like templates and the STL.