When compiling a contract in LIGO, declarations will get inlined if they are only used once and pure. Inlining often results in larger contracts and is therefore not aggressively done.
A pure declaration is one that doesn't cause side effects like causing a failure or operation.
In some cases you might want to override the default behaviour of LIGO and force inlining. The declaration still needs to be pure though.
To force inlining you can use the inline attribute.
const fst = (p: [nat, nat]) => p;
const main = (p: [nat, nat], s: [nat, nat]) : [list<operation>, [nat, nat]] =>
[list(), [fst([p, p]), fst([s, s])]];
Now if we measure the difference between inlining and without inlining, using
ligo info measure-contract name_of_contract.mligo --entry-point <entrypoint>, we see the
|With inlining||66 bytes|
|Without inlining||170 bytes|
Note that these results can change due to ongoing work to optimise output of the LIGO compiler.