> On Dec 6, 2015, at 5:16 PM, Karl Pickett via swift-users
> <swift-users@swift.org> wrote:
>
> When I use an inout param, that is 2x as fast and doesn't re-initialize each
> time. However I don't see why passing something immutably wouldn't be as
> fast.
Huh. That’s especially weird since the semantics of inout actually call for two
copies (after the called function returns, the copy of the struct that was
passed to it gets copied back into the original variable.) The compiler is
often able to optimize that down to the more-expected pass-by-pointer, as in
your example. So why then isn’t it able to optimize the non-inout case the same
way?
—Jens
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users