Well, you have to link either way, right? You can't avoid doing a link. So for a "fresh build" of a downstream project, using pre-built artifacts is "zero build + some link" and inserting a SHL is "some build + some link".
-
-
Replying to @Lokathor
No, with a SHL the library code is just included and compiled alongside your code. When you compile main.c you also compile lib.h with the implementation of the library.
1 reply 0 retweets 0 likes -
Replying to @SasLuca
Right, exactly, so a fresh build of the project, such as for CI, must build the SHL implementation code as well as your own code. Whereas if you had a pre-built artifact of the library then you'd skip the compilation of the library code and just build your own code. SHL+P >= 0+P
1 reply 0 retweets 0 likes -
Replying to @Lokathor
I guess it's my bad for assuming a single translation unit build which compiles instantly :))
1 reply 0 retweets 0 likes -
Replying to @SasLuca
Regardless of the rest of the organization of the project, if your lib is 10k lines, and your project is 5k lines, SHL is 15k lines compiled and pre-built is 5k lines compiled. Now, with single-translation-unit it might be too fast to notice either way, but it is a difference.
2 replies 0 retweets 0 likes -
This is an incorrect assumption. The compiler seeing all the at once means that no actual linking table is ever constructed, written, read, and resolved. It may often be _significantly_ faster to recompile an entire library than to link against a prebuilt version.
2 replies 1 retweet 4 likes -
Replying to @cmuratori @SasLuca
Ah, so when the final binary is known to be a single translation unit it short circuits the linking process, effectively?
1 reply 0 retweets 0 likes -
So you just put "static" in front of all of your functions, and that prevents them from ever going into the linking table. This causes the compiler to treat them as intra-unit linkage and it doesn't ever have to even do the work of moving to the link phase.
1 reply 1 retweet 3 likes -
So there is a potentially substantial savings (especially when you're in C++ name mangling ridiculousness land!) to be had here that you cannot discount out of hand.
1 reply 0 retweets 0 likes -
And then things get super huge as soon as you start talking about debug info, right - because now the _debug_ info has to be loaded, which is _massive_ (way bigger than the original source), parsed, _and merged_ with the exe if it's statically linked!
-
-
I think people don't really understand this process and they think they are saving time by precompiling, but you really just lose time if you precompile code that isn't ridiculous TensorFlow nonsense.
1 reply 0 retweets 1 like -
Replying to @cmuratori @SasLuca
Well most people that I've seen don't do single-translation-unit projects at all (though I don't follow a lot of C project I guess). Does all this remain true even if you've got a lot of translation units floating around?
1 reply 0 retweets 0 likes - Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.