Re:Apple Announces Full Swift Rewrite of the Foundation Fram...
by pkulak on Wednesday January 11, 2023 @02:51PM
(#34343636)
I don't know if you can write high-throughput systems with 100% reference counted GC. Swift is targeted at UI work pretty hard.
[ Parent
| on HN ]
Re:Apple Announces Full Swift Rewrite of the Foundation Fram...
by dcow on Wednesday January 11, 2023 @03:22PM
(#34344093)
Well that's why I said high level application use cases and not systems. Ideally I'd love to see a compile mode for modules where certain conveniences were enabled like: auto-clone, unified reference/owned types, disabled lifetimes and instead borrows become auto-wrapped-arcs, etc. That way you could care about that stuff in modules where it matters, and ignore it in areas where you prefer convenience over zero-cost abstractions and raw performance.
Re:Apple Announces Full Swift Rewrite of the Foundation Fram...
by georgelyon on Wednesday January 11, 2023 @03:54PM
(#34344607)
You could take a look a swift-nio (https://github.com/apple/swift-nio) which is a pretty high-throughput system. swift-nio does this using some reference-counted GC where it simplifies the code and doesn't affect performance. Otherwise, value-types are used which incur no GC overhead (unless they are copy-on-write, and backed by something that requires reference counting).
Re:Apple Announces Full Swift Rewrite of the Foundation Fram...
by kevinossia on Wednesday January 11, 2023 @10:36PM
(#34348869)
Sure you can. C++ has reference-counted garbage collection with its smart pointers and RAII, just like Swift. People certainly write high-throughput systems in C++.
Swift is slower than C++, yes, but not because of its memory management scheme.
Re:Apple Announces Full Swift Rewrite of the Foundation Fram...
by pkulak on Thursday January 12, 2023 @02:27AM
(#34350287)
Unless you go absolutely ham with smart pointers (which everyone knows not to do if you care about performance), C++ isn’t really a reference counting language.
I wouldn’t call RAII “reference counting”. I mean, I guess, but it’s the programmer or the compiler doing it. I’m talking about runtime reference counting.