considering that nlohmann::json not even a performance-oriented json library, generally benchmarking at 20% of the performance of RapidJSON (which itself is not even close to the fastest you can reach in C++) that's... scary
Just the other day I was trying to sort a large array of strings in Swift and it was painfully slow. A 3 lines Python script managed to sort the same dataset _at least_ 10x faster.
As a dataset, I just use find to generate a list of paths from the file system:
find / > large.txt
I tested with Swift 5.7 and 5.9, and Python is always between 4x and 10x faster.
The server-side Swift ecosystem has matured over the past few years, with specific attention from teams at Apple.
For example, regarding JSON, there has been a rewrite of the JSON encoder/decoder that results in a 200% - 500% speed up in deserialization! You can read about the (still ongoing) improvements to Foundation at https://github.com/apple/swift-foundation
Regarding logging, Apple has been pushing the development of community around the swift-log package at https://github.com/apple/swift-log. Maybe you’ve seen this, but just wanted to share!
One last thing: the Swift VSCode extension is actually really good! Not sure when you used it last, but I’ve been using it on a regular basis and it’s been great — and is only getting better. Here’s the link to the extension if you’re curious: https://marketplace.visualstudio.com/items?itemName=sswg.swi...
It’s true that Swift has had its various issues, but there’s a very real push by the core team and community to bring the language to new heights and places. Cross-platform support is getting better and better (check out what The Browser Company is doing with Swift on Windows) and a big source of performance bottlenecks are being addressed with the development of non-copyable and non-escaping types (Rust-like move-only types)!
Sorry that’s a lot, but I just wanted to point out that there’s a lot of hope in Swift and really interesting things are happening for the project!
I experimented with several logger implementations, likely to have used the one you’re suggesting. Thanks for pointing it out.
With the Vscode extension and the language server I suppose I had very palatable experience. It just didn’t work most of the time until I’d recompile the projects. Setting it up was a bit annoying as well, no build tool chain automations for project imports and setup, had to do the setup by hand. If I recall correctly, with one project an unpleasant issue I had was with the Swift Package Manager and CocoaPods, the Vscode extension wouldn’t recognize the project structure, and I ended up setting up a CMake project, good I have an affinity for CMake, and exporting it. But Xcode did just alright with it. So I just went back to Xcode for all my Swift projects. I think a plain SPM project actually got properly recognized in Vscode, but lots of dependencies are beyond SPM, which incidentally is also quite a significant annoyance in the Swift ecosystem.
I wish Swift enjoyed more attention, like .NET has been having. Oh and in terms of documentation I feel Swift is nowhere near .NET, even though the setting is comparable.
Referring to your closing remark, I don’t feel like that’s a lot, it’s a pleasure to learn more about Swift’s ecosystem, so thanks for taking your time to reply and providing extra context.
For example, this submission currently has 136 upvotes and 60 generally positive comments. The last .NET submission that reached frontpage had 158 upvotes and 255 comments, many of which would repeat personal experiences from 2007, complaining about products and languages that are not related to .NET but to something adjacent at best, or criticizing imagined spec and implementation issues that do not correspond to how the runtime and language actually work.
If anything, it seems like Swift can succeed if Apple puts more effort into it and community sentiment will be headwinds, not the other way around as is the case with .NET.
Recent examples MSTest being proprietary for Native AOT testing, and no plans to help improve xUnit into that direction.
New VS Solution format, that might only be supported on the C# Dev Kit, also under VS license.
Killing VS4Mac, which although it has its own set of issues, VSCode still doesn't provide the same level of tooling for Mac and iDevices development as VS4Mac did, forcing anyone that cares to go out and buy Rider licenses instead.
The dotnet watch removal drama to only have hot-reload available on VS, thankfully back pedalled only thanks the engagement of high level .NET developers, with help of the community backslash on social media.
(context: pjmlp likes to post about .NET, Java and other adjacent platforms with authoritative and confident tone not backed up by source material or simply reposting second hand or surface impressions of events, rather than just reading through publicly available information in full which could help some of the comments with being less detached from reality)
(context: neonsunset professional life is highly dependent on where .NET goes, biased by involvement on .NET team's work, and how .NET is perceived by the world outside Redmond).
And it is worth remembering that Objective-C only got ARC, because adding a tracing GC was a failure, given C semantics, and most applications being prone to crashes, when the GC got pointers wrong, thus automating retain/release pairs was a much safer approach.
But whenever it’s come to performance on the backend, it would be not enough by a large margin. Take JSON serialization for instance, even using a yyjson wrapper it’s been nowhere near the original C performance, slower than Jackson, nlohmann::json, Go’s stdlib, and serde of course. I tried several Swift libraries. Model definition for custom deserializers alone for the few common ISO timestamp representations is a bit cumbersome but bearable. With some other formats and protocols I use, Swift is similarly underwhelming. Logging takes a large toll in performance as well, regardless of what a library appears to suggest when speaking of “efficiency.” I just can’t seem to squeeze out enough performance out of Swift. Async Postgres IO was quite good until I ramped up the load. TechEmpower benchmarks place Vapor relatively low. I get much better performance from low-effort Spring on Kotlin, needless to mention more performant backend frameworks.
Then the IDE story is very bleak. While I’m on Macs, Xcode just doesn’t cut it for me to be productive. Jetbrains discontinued their dedicated IDE and their Vscode pendent is still experimental. Vscode proper support for Swift is not really worth mentioning in my opinion. So I’m basically left with Xcode as an IDE for Swift.
I so dearly wanted to introduce Swift on the backend at my company but that’s just unrealistic right now.