5 ms·
I'm interested in a performance comparison between Swift, C, Lua, Nim. The post says Swift is performant, but offers no data or reasoning to back up that claim.
by msephton 3y ago
I'm interested in a performance comparison between Swift, C, Lua, Nim. The post says Swift is performant, but offers no data or reasoning to back up that claim. I'm sure it is, but it would help to see data.
- jerbear4328 3y agoI don't think the post was trying to prove that fact, just explaining a personal choice. I don't think every Rust project should have to include benchmarks to prove that Rust was the right choice.
- msephton 3y agoThe post stated Swift is performant, and I just wondered was that claim referring to this embedded version or was it a more general Swift assumption. Anyway, the Playdate community has done some testing and the Swift code for the Life example, as released in the blog post, runs about 60% the speed of the C example it was based on. So it seems the claim was an assumption that it must be performant because it's Swift, rather than the result of any comparison or testing. It looks like I was too optimistic :)
- bsdpufferfish 3y agoSwift can be written in many ways with different performance tradeoffs. The slower ways looks like Objective-C or functional programming. The faster ways look like ergonomic C or C++.
- msephton 3y agoThat's exactly it. It seems this example is not optimised in any way, so in my testing it performs worse than the C version. I'm hopeful that won't be the case for very long.
- tokyovigilante 3y agohttps://github.com/attractivechaos/plb2 https://github.com/attractivechaos/plb2 - limited but broad comparison across a large number of languages. Swift and Nim both compare favourably to C.
- msephton 3y agoRight, but that's not this specific embedded version of Swift which currently has many compromises and omissions.
- tokyovigilante 3y agoSure, the more complex language features, which those basic benchmarks aren’t really looking at.