<story><title>Don&apos;t pass structs bigger than 16 bytes on AMD64</title><url>https://gist.github.com/FeepingCreature/5dff669aad380a123b15659e195fb96c</url></story><parent_chain><item><author>pclmulqdq</author><text>The cost of argument passing is rarely well-understood, and I&amp;#x27;m glad someone wrote this.  People routinely pass 24-byte objects by value in places like Google, and the cost of that practice doesn&amp;#x27;t show up on a profiler because it&amp;#x27;s spread out on every function.</text></item></parent_chain><comment><author>Cloudef</author><text>Pass by value &amp;#x2F; pass by ref is quite a bit of mental overhead as it effectively affects your ABI&amp;#x2F;API. Zig tries to not force this so as long as you &amp;quot;pass by value&amp;quot;, the compiler can actually decide to pass it by reference. It does expose this kind of footgun though &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;ziglang&amp;#x2F;zig&amp;#x2F;issues&amp;#x2F;5973#issuecomment-1330743975&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;ziglang&amp;#x2F;zig&amp;#x2F;issues&amp;#x2F;5973#issuecomment-1330...&lt;/a&gt;</text></comment>
<story><title>Don&apos;t pass structs bigger than 16 bytes on AMD64</title><url>https://gist.github.com/FeepingCreature/5dff669aad380a123b15659e195fb96c</url></story><parent_chain><item><author>pclmulqdq</author><text>The cost of argument passing is rarely well-understood, and I&amp;#x27;m glad someone wrote this.  People routinely pass 24-byte objects by value in places like Google, and the cost of that practice doesn&amp;#x27;t show up on a profiler because it&amp;#x27;s spread out on every function.</text></item></parent_chain><comment><author>elromulous</author><text>&amp;quot;in places like Google&amp;quot;.&lt;p&gt;Are you speaking from experience?&lt;p&gt;As a former googler, I can say with certainty that the guidelines for passing any non primitive is pointer or ref.&lt;p&gt;string_view might be the only exception I can think of.</text></comment>