1 hour ago · Tech · hide

Inlining is a key optimisation because it allows a compiler to see beyond the function as written. This extra visibility allows the compiler to then prove parameters are constant, return values do not escape their caller, the outcome of conditins becomes known, the bounds of array accesses become provable, and many more. Like its bigger sibling, TinyGo supports automatic inlining because LLVM provides strong support for it. This post explores how the various optimisation flags tinygo offers, and the two inlining pragmas, impact the inlining decisions LLVM makes. //go:inline vs //go:noinline Before I discuss the details of optimisation flags, I need to set the stage. Big Go, and thus TinyGo, support the former's //go:noinline pragma. As its name suggests, when attached to a function, the compiler will not inline that function, period. This is mostly used in testing or debugging, but is occasionally useful in convincing the compiler to not hoist common, small, cold helpers. In 2020, as…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town