[swift-evolution] Pitch: (Almost) std libs

Jordan Rose jordan_rose at apple.com
Tue Jan 26 21:45:26 CST 2016


> On Jan 26, 2016, at 18:49 , David Turnbull via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Functions in a module go through dynamic dispatch. Operators are functions. So multiplying two complex numbers won't get inlined. The stdlib uses internal tricks so what appears as a module you import is available to be specialized and inlined.
> 
> To see this in action, try the CubeWorld demo from here: https://github.com/AE9RB/SwiftGL <https://github.com/AE9RB/SwiftGL>
> Then change it so the math libraries aren't modules (move the files, delete the import statements). On my system, CPU drops from 60% to 6%. It's also the difference between 150 cubes and 1200 cubes at 60 fps. Make sure you turn on WMO.
> 
> I'm told it won't always be this way. But it is today.

Yep. We're planning to improve this but right now it's true: inlining and generic specialization does not happen across framework boundaries.

Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160126/46ba5eb9/attachment.html>


More information about the swift-evolution mailing list