> On Jan 16, 2017, at 9:43 AM, Charles Srstka via swift-evolution
> <[email protected]> wrote:
> I don’t even know how long it actually takes to finish this test, because the
> last time I did this I eventually got sick of waiting and killed the process.
> So, I don’t know quite how many orders of magnitude slower it is, but it’s a
> lot.
That’s all the endorsement I need. +1 from me.
I do wonder if there is any way to get this sort of optimization out of the
compiler. I suppose it would be difficult because the compiler doesn’t know
what the mutable vs immutable pairs are or if such a pair even exists (array
doesn’t have appending()).
If we assume + for Array had a mutating variant ala func + (lhs: inout Array,
rhs: Array) { … }, would the compiler be able to prefer the inout version? What
if a type wanted to offer a specialized version of a function for the compiler
to call when the compiler can prove only temporaries are involved? I don’t want
to go too far down the road of move constructors and whatnot for that way lies
madness.
(Not a compiler expert, just wondering if there is a way to make situations
like this into a “pit of success”).
Russ_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution