2 ms·
What do you think they could have done better in the Swift code?
by pizlonator 10mo ago
What do you think they could have done better in the Swift code?
- viktorcode 10mo agoUsing overflow operators instead of the ones that check for that each iteration.
- Someone 10mo agoReading https://github.com/niklas-heer/speed-comparison/blob/master/src/leibniz.swift https://github.com/niklas-heer/speed-comparison/blob/master/..., I think the only overflow checks could be in for i in 2...rounds+2 and I would hope/expect the compiler to be smart enough to know that it only has to check “rounds+2” once there. Swift isn’t exactly new anymore, and it’s supported by a large company. What do I overlook?
- pizlonator 10mo agoThere’s no way overflow checks are responsible for that enormous speed difference from C
- deleted 10mo ago[deleted]