6 ms·
I don't know if you can write high-throughput systems with 100% reference counted GC. Swift is targeted at UI work pretty hard.
by pkulak 4y ago
I don't know if you can write high-throughput systems with 100% reference counted GC. Swift is targeted at UI work pretty hard.
- dcow 4y agoWell 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.
- georgelyon 4y agoYou could take a look a swift-nio (https://github.com/apple/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).
- deleted 4y ago[deleted]
- kevinossia 4y agoSure 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.
- pkulak 4y agoUnless 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.