4 ms·
I've never written native code for an apple device, but have some low-level experience on other things; my guess would be that idiomatic swift contains safety c
by emn13 5y ago
I've never written native code for an apple device, but have some low-level experience on other things; my guess would be that idiomatic swift contains safety checks, i.e. predictable branches, but branches nevertheless - and that simpler cores with poor or no branch prediction suffer much more heavily than "smarter" cores from that kind of code.
At the end of the day, if all you're doing is basic adding/multiplying, you just don't need a fancy core (and hence: GPGPU, right?)
So this microbenchmark result isn't very surprising, although it's nice to see the principles in action.
- saagarjha 5y agoThat is correct. Also, the checks have a bit of an unfortunate downside that they need to be emitted for each array access if the loop is unrolled (as it should be here).