10 thousand times faster Swift
Bad news: the optimizer is moving your functions outside the loop.<p><pre><code>    for _ in 0..&lt;iterations {
        let result = flatuseStruct(outputData)
        assert(result == 8644311667)
        total = total + UInt64(result)
    }
</code></pre>
Looking at the assembly... the call to `flatuseStruct` is moved <i>outside</i> the loop in Release builds. You&#x27;re only measuring 1 thousand iterations of `flatuseStruct`, not 1 million.<p>Your red flag should have been this:<p>&gt; One million times decoding of a small object graph took 0.35ms<p>That&#x27;s literally impossible. That&#x27;s doing 2.8 billion iterations per second. A single function call generally takes 2 nanoseconds (you can&#x27;t do 1 billion per second).