# Mid-stack inlining in Go

DevFeed: [Mid-stack inlining in Go](<https://devfeed.tech/articles/mid-stack-inlining-in-go-20830.md>)

Original publisher: [Read original article](<https://dave.cheney.net/2020/05/02/mid-stack-inlining-in-go>)

Author: Dave Cheney

Published: 2020-05-02T05:09:15Z

Content type: article

Language: en

Sources: [Dave Cheney](<https://devfeed.tech/sources/dave-cheney.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [compilation](<https://devfeed.tech/tags/compilation.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [go](<https://devfeed.tech/tags/go.md>), [inlining](<https://devfeed.tech/tags/inlining.md>), [optimisation](<https://devfeed.tech/tags/optimisation.md>), [performance](<https://devfeed.tech/tags/performance.md>), [programming](<https://devfeed.tech/tags/programming.md>)

## AI overview

This article explains the limits of inlining in Go, comparing leaf and mid-stack inlining. It covers the trade-offs among execution speed, compile time, binary size, optimization opportunities, and the compiler's inlining budget.

## Source excerpt

In the previous post I discussed how leaf inlining allows the Go compiler to reduce the overhead of function calls and extend optimisation opportunities across function boundaries. In this post I'll discuss the limits of inlining and leaf vs mid-stack inlining. The limits of inlining Inlining a function into its caller removes the call's overhead [...]