News for hackers. Stuff that matters.
Re:Garbage Collection by ridiculous_fish on Sunday December 01, 2019 @01:41AM (#21674214)
One difference is optimization. Rust's Arc is runtime-only, while Clang's ARC is understood by the compiler and optimizer. This allows eliding balanced mutations, and also weird ABIs - functions which return a +1 object, or functions which accept a +1 object. See Arc#Optimization [1].

More generally there's an ABI. While to Rust "Arc is just another tool", reference counting is deeply pervasive on iOS and macOS. You would not attempt to pass a Rust Arc to C, and expect something useful to happen. But Clang's ARC works well with C, and Swift, and with ObjC and even with ObjC-pre-ARC. This isn't a critique of Rust, just reflecting different priorities.

1: https://clang.llvm.org/docs/AutomaticReferenceCounting.html#...

Re:Garbage Collection by pjmlp on Sunday December 01, 2019 @04:40AM (#21674707)
Those compiler optimizations need some work I guess.

https://github.com/ixy-languages/ixy-languages

Re:Garbage Collection by tom_mellior on Sunday December 01, 2019 @05:57AM (#21674896)
Personally, I appreciate you posting this link once, but seeing it this many times gets tedious.
Re:Garbage Collection by pjmlp on Sunday December 01, 2019 @06:07AM (#21674911)
Unfortunately it is hard to give an answer were all advocates of "Swift ARC performance" are able to read, thus urban myths keep being spread.

ARC makes sense given Objective-C compatibility, as otherwise a layer similar to RCW on .NET for dealing with COM/UWP would be needed.

And Objective-C only dropped its tracing GC, because it was too unstable while mixing GC enabled frameworks with classical ones, while making the compiler automatically call retain/release would provide better productivity without being unstable.

Re:Garbage Collection by tom_mellior on Sunday December 01, 2019 @08:03AM (#21675273)
I understand the urge to reply in multiple places. I think it would be better to write up some more detailed reasoning, like you did here, and link to this from multiple subthreads. Better than just repeating the same ixy link with a new snide comment each time.
Re:Garbage Collection by pjmlp on Sunday December 01, 2019 @08:10AM (#21675309)
Makes sense.
Re:Garbage Collection by mpweiher on Sunday December 01, 2019 @12:28PM (#21676577)
> too unstable while mixing GC enabled frameworks with classical ones

Actually, you couldn't mix them. The GC simply never really worked properly.

Re:Garbage Collection by pjmlp on Sunday December 01, 2019 @02:23PM (#21677286)
True, however Apple's documentation suggested otherwise, that it was possible "with care".

But as you say, it never worked properly.

Re:Garbage Collection by mpweiher on Sunday December 01, 2019 @03:34PM (#21677637)
I think what you are referring to is "mixed mode" frameworks, which were able to work in both GC and RC environments. You had to do a bit of work to get that.

Which is similar but not quite the same thing. Mixing pure GC and pure RC frameworks was never possible. In fact, I think there were some flags and the (dynamic) linker would balk.

Re:Garbage Collection by ridiculous_fish on Sunday December 01, 2019 @02:00PM (#21677165)
Which urban myth do you see being spread in this thread?
Re:Garbage Collection by pjmlp on Sunday December 01, 2019 @02:22PM (#21677277)
ARC outperforming modern tracing GCs.
Re:Garbage Collection by ridiculous_fish on Sunday December 01, 2019 @02:40PM (#21677378)
Literally nobody here has said that.
Re:Garbage Collection by pjmlp on Sunday December 01, 2019 @04:06PM (#21677779)
I could collect statements about Swift compiler performance, how it removes retain/release calls, or how reference counting is so much better than tracing GC, but yeah lets live at here.