3 ms·
This is not a good representative benchmark for Swift. It uses lots of reference counted objects within tight loops, which is a worst-case for Swift. It's als
by skohan 7y ago
This is not a good representative benchmark for Swift. It uses lots of reference counted objects within tight loops, which is a worst-case for Swift. It's also not idiomatic Swift - classes are used in many places where they should not be.
Also, it's a benchmark which needs special hardware to be run, so it's not easy to try to reproduce or improve on this result.
- pjmlp 7y agoThe same conditions apply to all languages.
- skohan 7y agoNo they don't. GC language, for example, are more sensitive to memory pressure to reference counting overhead.
- pjmlp 7y agoFirst, Swift is also a GC language. Secondly, with exception of Java, the remaining ones on that benchmark support value types and native heap allocations.
- skohan 7y agoWe can get into semantics all day, but the point still stands that different languages are going to perform differently on any given benchmarks due to the performance constraints of that language. Also I would love to see an implementation of the swift benchmark which doesn't lean on reference types, which is not idiomatic swift and is likely the reason the ARC penalty is so high here.