6 ms·
So it's not really the secrets of Swift's speed, it's more like not doing what made Objective-C slow.
by CountHackulus 12y ago
So it's not really the secrets of Swift's speed, it's more like not doing what made Objective-C slow.
- gress 12y agoObjective-C isn't slow. It's a strict superset of C, so anything that C can do fast, Objective-C can do just as fast. If you say Objective-C is slow, you are also saying C is slow. Objective-C provides a message passing mechanism that trades speed for convenience. It turns out that programmers often choose convenience over speed because of time pressure.
- erichocean 12y agoGoing further, writing just C code to replicate what the Objective-C runtime actually does (dynamic dispatch) is also slower than Objective-C and it's hand-tuned, written-in-assembler runtime at those same tasks. So, Objective-C (at least on Apple's operating systems) is as fast as C AND faster than C at a few highly specific things.