5 ms·
Go 1.22 Inlining Overhaul
- pjmlp 3y agoAll in all, looks like good ideas.
- OfferFun6595 3y agoIt looks convincing enough honestly
- kitd 3y agoAnyone know what the "PGO" referred to in TFA is?
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- miscaccount 3y agoprofile guided optimization https://learn.microsoft.com/en-us/cpp/build/profile-guided-optimizations?view=msvc-170 https://learn.microsoft.com/en-us/cpp/build/profile-guided-o...
- mseepgood 3y agoBetter link in relation to Go: https://go.dev/doc/pgo https://go.dev/doc/pgo
- monlockandkey 3y agoI wonder if a "release" build flag makes sense for go. There is so much optimisation potential left on the table for the sake of build time. The current build should be "Dev" and a new "release" should be introduced.
- tgv 3y agoNot bad, but build should default to release, and dev builds should be opt-in. You should never accidentally test against a non-production build.
- packetlost 3y agoIt's a tough problem, because the situations in which fast build times matter are mostly during local development and test. Only at really insane scales do they become a problem for production releasing and CI/automated testing. An environment variable that can be set on a dev workstation globally (and overridden with CLI flags) would probably be sufficient for opt-in
- bjoli 3y agoI don't know if you have ever written an inliner, but it seems simple enough until you realise you are trying to restrain a rabid dog on a leash. I wrote one a long time ago that was a part of a project that was moderately popular, but it had issues and incremental changes had a tendency to trigger weird edge cases. in the end someone with a CS PhD wrote a different one (while keeping quiet on the awfulness of my implementation) and it was so much nicer in every way. Reading his code was like reading poetry. That was when I realised code should be deliberate. Every line is a step towards a goal. I think that is why rewriting something when you understand the problem domain better can be so liberating.
- pjmlp 3y agoA good example on C and C++ code, is the UB that isn't there in first place, but gets triggered due to the way code is inlined, and suddenly the optimizer becomes aware of optimization opportunities that wouldn't be taken, if it wasn't for the code being inlined.
- kevincox 3y agoI'm not sure that I understand. A compiler inlining a function can't create undefined behaviour (UB) where there wasn't any before. Otherwise it would be breaking valid code. Do you mean that after inlining the compiler has more visibility can can idenitfy UB that it was not sure was UB before?
- bjoli 3y agoAn inliner should, by itself, never introduce a bug, except maybe inefficient code. An inliner together with other optimizations can definitely lead to weird behaviour if you are not intimately familiar with the C spec. Inlining can be a problem as it is the reason many other optimizations are being run. For example, I managed to recover "sensitive data" due to a DSR pass being run after inlining. The code worked fine at O1, but kept "sensitive data" ( not really, it was a programming course in HS where we broke eachothers programs) in memory at O2. Edit: but yes, almost all of the time the problem is PEBKAC.
- nubinetwork 3y ago[flagged]
- arp242 3y agoNone of these have any discussion and most barely have any upvotes. That is: it's not really a "duplicate".
- deagle50 3y agoWhat would have been bad about letting us annotate hot functions? My binary size is my problem.