Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


I 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.


The 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 :)


Swift 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++.


That'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.


https://github.com/attractivechaos/plb2 - limited but broad comparison across a large number of languages. Swift and Nim both compare favourably to C.


Right, but that's not this specific embedded version of Swift which currently has many compromises and omissions.


Sure, the more complex language features, which those basic benchmarks aren’t really looking at.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: