5 ms·
Not quite systems programming but this might give you some insight. Swift is memory efficient, and runs stable backend services. I've seen benchmarks showing th
by ppeetteerr 8mo ago
Not quite systems programming but this might give you some insight. Swift is memory efficient, and runs stable backend services. I've seen benchmarks showing that it's slightly more performant than typescript but twice as memory efficient (but not as efficient when it comes to memory management compared to Rust, C, and C++).
The other point I've seen is that its string library is slow and very accurate.
Besides that, the C-interop means you have quite a bit of flexibility in leveraging existing libraries.
- ComputerGuru 8mo agoBeing only slightly more performant than an interpreted GC-only language is hard to believe (even though typescript is just a spec and you probably meant slightly more performant than v8).
- ppeetteerr 8mo agoThat's right, I said TypeScript but yeah, it's v8 under the hood.
- fauigerzigerk 8mo ago>The other point I've seen is that its string library is slow and very accurate. Swift strings default to operating on grapheme clusters, which is relatively slow. But you can always choose to work with the underlying UTF-8 representation or with unicode scalars, which is fast. The only situation where UTF-8 incurs overhead is if the String comes from some old Objective-C API that gives you a UTF-16 encoded String.
- zozbot234 8mo ago> Swift strings default to operating on grapheme clusters, which is relatively slow. The unicode-segmentation crate implements this for Rust, in case it matters for accuracy.
- wahnfrieden 8mo agoUnicode scalars are not so fast. But yes working directly with UInt8/Data bytes is efficient. That’s how I took over maintenance of SwiftSoup and made it over 10x faster according to my benchmarks. Besides various other optimizations such as reducing copying, adding indexes, etc.
- wahnfrieden 8mo agoFor web server benchmarks, it’s far behind typescript. Async has further degraded performance competitiveness It also has C++ interop btw