3 ms·
When you say 100x slowdowns with ARC, are you talking about Swift or Objective-C? If the latter, do you have a concrete example of that happening? My experience
by mikeash 12y ago
When you say 100x slowdowns with ARC, are you talking about Swift or Objective-C? If the latter, do you have a concrete example of that happening? My experience has been that ARC is typically negligible, worst case a relatively small factor, and can be quite a bit faster due to things like autorelease elision if you hit the right situation.
As for "very slow defaults that you must trust the compiler to make fast again", that applies to just about every language that wants to be fast at all. C compilers generate awful code when the optimizer is turned off.
- mpweiher 12y agoFor the 100x slowdowns, I am talking about Swift, though if you want to see a 20x slowdown in Objective-C, look here: http://blog.metaobject.com/2014/06/compiler-writers-gone-wild-arc-madness.html http://blog.metaobject.com/2014/06/compiler-writers-gone-wil... Yes, the optimizer can take care of it some times, most of the time, ..., but phew! While C compilers also generate pretty bad code when optimizations are off, it's nothing near this staggeringly awful. Unless you manage to write a longish loop that it can figure out, which is unlikely outside of benchmarks, my experience is you get around 2x or so for straight-line code that's pretty rare these days. This is 20x to 100x and more. The 2x roughly matches Probsting's Law[1], which says that advances in compiler optimizer tech. double performance every 18 years. That's not a lot, and does not justify trusting the compiler this much. In short, making the semantics slow and trusting the sufficiently smart compiler [2] to fix it has never worked in the past, and I don't see any evidence why this time should be different. [1] http://www.cs.virginia.edu/~techrep/CS-2001-12.pdf http://www.cs.virginia.edu/~techrep/CS-2001-12.pdf [2] http://c2.com/cgi/wiki?SufficientlySmartCompiler http://c2.com/cgi/wiki?SufficientlySmartCompiler
- mikeash 12y agoAre you measuring a 20x slowdown with optimizations turned off? That's the only way I can reproduce your results. That's a completely meaningless comparison if so.
- mpweiher 12y agoWell, no, it's not meaningless in the context of TFA: http://blog.metaobject.com/2014/06/compiler-writers-gone-wild-arc-madness.html http://blog.metaobject.com/2014/06/compiler-writers-gone-wil...