Live data from Hacker News

Swift Performance: Too Slow for Production

blog.sudeium.com

11–17 of 17 posts

Re: Swift Performance: Too Slow for Production

#11
I find posts like this nearly entirely lacking in interest. There was so much attitude and not near enough actual analysis. A much stronger post would have actually disassembled the resulting code in each of the different configurations, and looked to see why the various permutations had the performance that they did. We would then have a much stronger understanding of where Swift's performance is at, instead of looking at a series of not exactly equivalent benchmarks that leave us wondering if we're not just seeing an artifact of the differences in the benchmark code as opposed to differences in real-world performance.

I for one would not be changing my approach based on this post. I might start doing some disassembly if I was writing performance sensitive production code in Swift, but that would be about it.

Re: Swift Performance: Too Slow for Production

#12
Even as Python programmer I find the boast "2.6x faster than Objective-C and 8.4x faster than Python 2.7" pretty bizarre. So Objective-C is a statically typed, compiled, C superset and still only 3.5x faster than Python? That is not really something to be proud of.

Re: Swift Performance: Too Slow for Production

#14
post #12

Even as Python programmer I find the boast "2.6x faster than Objective-C and 8.4x faster than Python 2.7" pretty bizarre. So Objective-C is a statically typed, compiled, C superset and still only 3.5x faster than Python? That is not really something to be proud of.

Not an Objective-C programmer, but while includes static typing, it's also very dynamic. It uses a message-sending paradigm and you can construct messages at run-time from strings.

I believe Smalltalk is as about as much of an influence as C.

Lots of Objective-C programmers actively dislike Swift because it's so static.

Re: Swift Performance: Too Slow for Production

#15
I hacked together a quick reproduction of this since the author didn't provide any working code. I don't really know Swift and my Objective-C skills are pretty rusty at the moment, but it compiles and show similar performance characteristics: https://github.com/mnem/swift-json-speedtests

The initial Swift version the author created uses a third party library for wrapping the JSON decoding and that library appears to create a metric shit ton (technical term) of short lived objects whilst performing its magic. I cobbled together a less memory insane version (likely similar to the one described as Obj-C in Swift - although I disagree with that description) which is an order of magnitude faster. Finally there is an Objective-C version which is an order of magnitude faster again. All tests were running on an iPhone 5s in release mode.

Decoding JSON is an annoying task for most languages. That Swift decodes half a megabyte of JSON in a tenth of a second is a reasonable trade off, for me, when comparing it to the verbosity and occasional fiddlyness of working with Obj-C. It was quite nice to see how simple it was to mix Swift and Obj-C as I was creating this, so that suggests little downside to using Swift for the mundane tasks and coding specific bits in Obj-C when that's necessary for speed reasons - although Obj-C is not uniformly faster than Swift as noted in other articles.

Re: Swift Performance: Too Slow for Production

#16
post #5

I'm currently deciding whether to start a project in Swift or Objective-C, I know very little about either, for learning purposes Objective C has the edge but I don't want to invest time learning something that's on its way out.

I doubt Objective C is on its way out...

Why not? This is Apple we're talking about, they're famous for getting rid of older stuff.

A lot of experienced Apple developers do not expect Apple to support two languages for a long time. With all the noise Apple made about Swift, it will be getting more TLC than Obj-C and eventually, Obj-C will not be supported anymore.

We're not talking about a few years, we're talking maybe Carbon>Cocoa style, 5 years before Apple starts warning devs that Obj-C would be phased out in several years.

Re: Swift Performance: Too Slow for Production

#17
Too Slow for Production _for now_.

Swift hasn't even been out for a year. Look at the progress it made since summer, it sped up a lot in certain parts.

Just file a radar on what's slow and they'll fix it.

Apple intentionally is shipping Swift as is to get devs ready and start planning for the next five years.

Post reply on HN