Apple’s new Swift language explained: A clever move to boost iOS, while holding Android apps back

While Apple’s WWDC keynote yesterday was full of exciting new changes and features, one piece of news caught everyone off guard: With iOS 8 and OS X 10.10, and the the latest version of the Xcode developer tools, Apple has introduced a whole new programming language called Swift. According to Apple, Swift will make it a lot easier and more fun to develop apps for both iOS and OS X — in contrast to the current language, Objective-C, which has been likened by esteemed programmers to pulling teeth. Swift will also apparently bring a significant performance boost over Objective-C programs.

While Apple is being fairly coy about the exact reasoning behind the launch of Swift, it’s probably to reel in more developers, who will then create more apps, ensuring the continued dominance of iOS app ecosystem. But hey, we’re getting ahead of ourselves: What is the Swift programming language, anyway? And how can switching to a new programming language provide a massive 50% performance boost over a language that is already considered to be pretty fast?

What is Swift?

A small example of some Swift source code

For a start, the Swift language bears no relation to the Swift (A6) CPU architecture or the existing Swift parallel scripting language. Obviously, when Apple decides on a name for a product, it doesn’t let existing products or trademarks get in the way.

In the words of Apple, Swift is like “Objective-C without the C.” The introduction to Swift on the Apple developer website outlines Swift as safe, concise, and interactive (your code is interpreted and rendered in a live “Playground” view in the Xcode IDE).

In this context, “safe” mostly refers to the fact that the language is type safe — but thanks to type inference, type declarations are less onerous, making Swift more concise than C or Objective-C. The Switch statement is also is also safer and easier to use than the C counterpart. The two-phase initialization process for classes, slightly tweaked from the Objective-C way of doing things, also improves safety. Along with type inference, Swift also introduces very concise closures (lambdas).

A larger Swift source code sample, this time showing the Switch statement. It’s fairly human-readable, even for non-programmers.

On the compilation and runtime side of things, Swift targets the same Cocoa (OS X) and Cocoa Touch (iOS) APIs, and uses the same LLVM as Objective-C. Swift code can co-exist with Objective-C code in the same project, encouraging adoption.

A deep analysis of Swift is beyond the scope of this story, but in general it shares a lot of similarities with other modern languages, such as Rust, with a lot of popular ideas and patterns that have been assimilated from other languages. There will be a lot of cries that Apple copied/imitated/ripped off other languages — but ignore them. When it comes to programming languages, this kind of imitation and embrace-and-extent evolution is the norm, and a sign that everything is working as intended.

Will Swift apps be faster than Objective-C apps?

On stage at WWDC, Apple’s Craig Federighi showed some interesting graphs that appeared to show a huge 40-50% performance lead for Swift over Objective-C. He did not say that apps written in Swift would be faster than Objective-C, though. And he was very picky about which benchmarks he showed. In reality, Swift is very unlikely to be significantly faster than Objective-C. They are both statically typed, compiled languages — using the same LLVM compiler, no less. To obtain such a graph, Apple probably had to choose an Objective-C feature that is known to be slow/buggy — or intentionally optimize a Swift feature, purely for the sake of producing a pretty graph.

We look forward to doing some real benchmarking in the coming weeks and months, though, as Swift apps start pop up on the App Store.

Tagged In

“Thanks to their shared support for C, and tools to port Objective-C to Java, it’s currently fairly easy to port an app from iOS to Android. Porting Swift apps to Android, on the other hand, would be a lot more time consuming.”

Have you seen Java? Objective-C? One is a C “based” (in that it uses things like : and {}) and one is C plus some stuff. Java does not “support” C. Porting Swift apps to Android will more than likely be MUCH easier than Objective-C as Swift is very similar to multiple JVM Languages. They get translated to byte-code just like Java code. On Android, the Java classes get translated to … whatever Dalvik uses. So …

http://www.mrseb.co.uk/ Sebastian Anthony

I think the ease-of-porting is more to do with: a) Android can run C code with NDK, and b) There are some fairly mature tools that help port Obj-C code to Java.

You might be right as far as hand-tweaking goes, though!

c_world_poster

While i get your point, that is not what the quote said. “Shared support for C”. Java does not have that. Maybe he meant Android supports it like you said. Anyway, it is only time consuming because as of this moment, Swift is new and no one has had chance to write something to generate Android bytecode. Give them a week. It will take them less time than it did for Objective-C – for the same reason it will be easier for developers to write IOS/Mac apps in Apple’s new Language.

chojin999

Swift has some of the best features of C++ and Java BUT it has nothing to do with virtual machines like Java and .NET (so C#). Swift doesn’t run on a virtual machine. Swift is a new Objective-C extension that uses ARC automatically and will quickly phase out Objective-C.

c_world_poster

Right. Well, Swift does not CURRENTLY run on a vm. :) It could. But i doubt anyone would do that since there are so many languages 80+% similar that do run on vm’s. Swift is about making so Apple Dev’s can have the same joy as the rest of us. :) And also those of us who left the world of C(C/C++/Objective-C) and for good reason, might consider writing specifically for Apple tech (I know i am).

So.

What does that have to do with porting code to Android? It seems you just said … it will still work since it works now.

Or did you not mean to respond to my post?

chojin999

Swift will never run on a virtual machine.
If you think that not writing in C/C++/Objective-C makes you a good programmer then you are so wrong.
You have no clue what programming really is if you can’t write anything in C languages and assembly.
Swift eases memory management thru the automatic use of ARC but still allows for some low level access to it anyway.
And the huge difference is that it’s not limiting programmers like Java and C# .NET and with no virtual machine it doesn’t slow down.

c_world_poster

LOL.

“Swift will never run on a virtual machine.”
Sweet. So you have a crystal ball? Can i borrow it?
FYI … Objective-C “effectively” runs in a vm. So… .
Anyway, it is just a language. The “output” can run anywhere.

“If you think that not writing in C/C++/Objective-C makes you a good programmer then you are so wrong.”

No. It makes me a “smarter” programmer. I have better things to do than deal with memory management. The first language i learned was C. But i can make money and enjoy programming – or debug my C program.

“You have no clue what programming really is if you can’t write anything in C languages and assembly.”

That is just hubris and total BS. Now if you only program in JavaScript then you don’t know what programming is. LOL. :) Just kidding. That being said, those have written in assembly – well, it does take talent. But you probably don’t want most of them coding in Java – or Swift. I’ve seen enough “JOBOL”.

“And the huge difference is that it’s not limiting programmers like Java and C# .NET”. Limiting how? And .NET is a platform.

“and with no virtual machine it doesn’t slow down”

What does run in a vm have to do with slowing down? If you do some research you will find speeds between C and Java/C# (ok, it really is the runtime Java – JRE – and .NET) are about the same and sometimes Java is faster. Believe what you want.

Anyway, when it comes to speed, it only needs to be fast enough. Remember … “Build for maintenance. Optimize where needed.”

chojin999

Objective-C doesn’t run in any virtual machine! What the heck are you talking about ?

You aren’t smarter, you are lazy and you have no clue how to program properly!
Speed in C about the same as Java/C# ? In your own dreams maybe..

massau

But does speed really matter ? i mean if i have to write twice the amount of lines and make the program 3 times as complex just to get a speed boost is it worth it?
I guess a new programming languish which is weakly typed and has lots of high level features would be a lot better than C.
but i needs the options to make the critical part strongly typed and optimized so i can declare an unitype var and or some normal vars like int.
It should contain vector operations and parallel loops in it standard packet. (c++11 thread is a good step).
now if the syntax is like python or matlab with multiple returns it would be the best.

chojin999

If you just want to code some non-commercial low quality slow programs for your personal use or for academic purpose then no, speed doesn’t matter much and you can allocate all the RAM you got available with no optimizations.

For any professional use, that includes programming games too which require proper low level optimizations to run properly, then the best speed and efficient memory management must be achieved to create high quality products.

massau

You can still make the more critical low level part at the C languish but when you get higher up than i guess other languishes are better in development speed.
i would still use precompiled programs but they get compiled at install like andooid does.

nerokaereborn

Most company that I know runs java webservice or system backend. Do you think they don’t care about the performance? It is usually possible to write software in C++ that processes data more efficiently than equivalent software written in Java. The difference is often marginal.

If you are going all way with that mentality then don’t program with C, program only with ASM. In many cases if you write an optimized asm code, it will outrun any c++ comprehend.

I studied comp engi, I know asm and used to know lots of various instruction set when I was programming embedded system. Now I’m making system backend with java, other way would make it less manageable and messy.

Do you want to run a faster program? stop using wired integrated ic, use field-programmable gate array and start to program with verilog. I bet none of your program would run faster than mine on fpga. Ofc the verilog code has to be as efficient as possible and would cost more time to write than yours on intel with c/c++.

keep in mine the lower you dig, the more optimization u have to work on and also the workload would increase exponentially.

chojin999

Most companies managers don’t care about quality. They just care about money and if they can pay programmers less they just do that regardless of wasting hardware resources and selling/using lower quality slower solutions.

massau

i like VHDL a lot it is easier to make it work 100% and test the separate modules.
but not all code works better on an FPGA it works wonderfull for parallel aperations and low latency. but it is not good when dooing general purpose computing because its lower clocks. it also wastes a lot of transistors in its linking fabric. A GPU would do better at graphics and a CPU would do better at branching and OS calculations. but a FPGA would do very good at some AI parts, codecs and neural network for detecting shapes.

but it would perform worse than an special purpose codec block.

c_world_poster

LOL. I love that he just said Netflix and Google and LinkedIn and Facebook and EBay and (i could go on ) suck. And pretty much everything in Apache.org sucks. Like Hadoop.

I am just continuing to reply because I wanna see how crazy you really get. What’s next?The earth is flat and immunizations are bad?

http://www.noisetech-software.com/Home.html Steven Noyes

Speed translates to power efficiency and on a mobile device it is paramount.

massau

yes it is finding the balance. Do you really need the extra speed or do you just want to produce your product faster. maybe just lowering the amount of tessellation would help a lot more on battery power and have less impact on visuals.

but there is nothing that prevents an extra high level languish to work slower than c++. they should just give you a low level lib with pointers and special stuff that is really low level.

it should also be mixed strong and weakly typed. so i can force it in integer math when needed.

vector operations which are missing in standard c, c++, would really speed up the performance.
high level parallelism would just make it easier to implement it. so more people would do it. compare posix thread to c++11 threads. standard parallel for loops and parallel algorithms would make the jop easier. like having parallel bitonic sort in the standard packet.

http://www.noisetech-software.com/Home.html Steven Noyes

To the user, speed translate to fewer clock cycles to do the same work. This allows the CPU to spin down its clock sooner saving battery. On mobile, this is a critical part of the design.

massau

except if you go for parallel processing than it uses more power. i don’t think that speed is always more energy efficient. fewer fetches also lower the power consumption significantly.
so a low cpu cycle count algorithm with lots of memory operations is less efficient than a algorithm that uses lots of cpu cycles but few memory operations.
if you don’t use some resources than it gets power gated.
so energy efficient design is a lot more complex than performance design.

an example would be branch coding les say you do a speculated branch and you are right than you did not waste energy and are faster but if you guess wrong than you wasted energy.

If you had waited until you knew which branch should have been taken than the processor could sleep for a short time and than you go further with your calculations. this is slower but more power efficient.

of course if you write bad in-efficient code than it is not power nor performance efficient. The choice of algorithm has more impact on the power usage than anything else (don’t expect bogo sort to be power efficient).

c_world_poster

FYI – please google what quotes around words mean.

I said “effectively” – For instance if you convert Objective-C to Java and then run that in the JVM, O-C “effectively” runs in a vm. https://code.google.com/p/objc2j/

I said “smarter”. Google about “lazy” programmers. They actually are good.

“you have no clue how to program properly!”. I guess you know me personally. You don’t get to define “properly”. Writing an app in C when C# will do (and there are times it will do), is not smart, nor non-lazy nor “properly”.

sm

“https://code.google.com/p/objc…”
The effectively look like a dead project :-)

c_world_poster

Right. Cause effectively so is Objective-C. :)

sm

“Objective-C “effectively” runs in a vm”

No, it doesn’t, not “effectively”, not at all.

“What does run in a vm have to do with slowing down?”

vm by definition involve an overhead and are inherently slower. Well written c++ code will always be faster then Java code (note the “Well” at the beginning!).

“Anyway, when it comes to speed, it only needs to be fast enough.”

These days, I also like it to preserve my battery life, so less overhead there is the better.

c_world_poster

I should have said “can run”. The overall point was a programming languages is just a “DSL for machine code”. Saying the absolute “Objective-C does not run in a vm” is not true. Well, other than Objective-C probably does not run anywhere. The compiled output does run somewhere.

“These days, I also like it to preserve my battery life, so less overhead there is the better” So don’t code in Objective-C. It is not C. It is slower than … well look it up.

http://www.noisetech-software.com/Home.html Steven Noyes

“I have better things to do than deal with memory management.”

I have dealt with Objective C for 10+ years and have never had to deal with memory management (in other words, it took less than .5% of my time). The dynamism of the language was a fresh breath of air after dealing with C# and Java.

Rick Fictus

You are not seeing the point. Swift is a programming language for those who are not good at programming, much like most Apple computers are for those who are not good with computers.

chojin999

You have no clue what you are talking about.
Swift is made to replace Objective-C and C completely.
It’s not a Basic, Java, Javascript, C# thing.
It gives full control to programmers and at the same time it eases everything making it simpler to code complex algorithms and mechanisms.
It’s not that just because it has an automatic ARC management with no pointers then it’s a joke. They achieved the opposite instead. They achieved the best compromise ever to give the power of C in a simplified syntax to allow experienced programmers to be more productive than ever before.
In 2-3 years Objective-C APIs will be completely phased out and everything will be switched over to Swift only. That is the big plan.

c_world_poster

I have to agree with chojin999 on this (partially). Swift is not about those not good a programming. Plenty of Java and C# and etc devs can code in C. They know that maintenance is typically more important that performance.

sm

“They know that maintenance is typically more important that performance.”
true, and I don’t see swift as introducing much inefficiency, maybe those super charge switch statement may translate to costly code, but then again, the compiler is probably in a better position than the programmer to optimise.
What I find sad is to loose the free bridge we enjoyed between C/C++/ObjC. Now back at building C bridge to re-use C++ code, like I was doing in the 90s :-(

TAH2

Obviously you are a 12 year old troll. But I’ll respond anyway.

Swift is the first language that is production ready that is a high level *Systems language”. Swift is no toy language. It is the first language I’ve seen than could finally unseat C or C++, which together with objC are the only serious systems languages out there. They aren’t any other languages that can provide Ruby/Python/Haskell level syntax, can provide C like native performance, and interact at a low-level too. Only other possibility is rust, and after years of effort, is still labeled as experimental.

Zanpher

“You have no clue what programming really is if you can’t write anything in C languages and assembly. “

Lol, in other words, you don’t know what programming is … way to out yourself.

TAH2

What you guys both miss is: Swift belongs to a new family of languages. Right now there are lots a nice languages built on VMs. They are comparatively slow, and use GC which is a memory and performance killing. VMs were all the rage in the 90s, but they are limited. They can not be systems languages. Built on top of LLVM, Swift blurs the lines between a JIT and compile time – it can do both!

All the speed of C, all of the syntax of ruby/python/Groovy/etc. The only other thing comparable is Rust.. and it hasn’t got as much interest in 3 years as Swift has in 2 days.

c_world_poster

You continue to confuse language with “runtime”. I can write in Java and have it natively run on iOS (not in a VM). For instance see http://www.robovm.com/.

“They can not be systems languages.” They can and are. Are there trade offs? Yes. Might you have to not use a VM? Yes. Look what is being done in the Devops space and the IaaS and PaaS spaces.

Fyi, Objective-C is not C. Google for some comparisons of C, Java, Objective-C (include codenameone in the search).

TAH2

Java cannot be a systems language by definition. Does it have pointers? Because at some point, at a system level you will have the need (Swift does). Java was designed around the notion of a VM, and is thus limited by its design, regardless of whether you can compile byte code to a binary through another means.

A clue here is what is most of the Android systems libraries written in? C or C++! Java is just an application layer on top. I don’t think any serious programmer would ever suggest using Java for systems programming (ever).

ObjectiveC is a strict superset very thin layer on top of C. They can be used intermixed without problem.

http://www.noisetech-software.com/Home.html Steven Noyes

Swift will get converted to machine code not byte code.

Tom Scharf

So…..you actually believe that an interpreted language will be 50% faster than a compiled language? Stop drinking the Kool-Aid, lest you embarrass yourself. The only possible way this could occur is if Objective-C was an absolutely horrible compiler.

While certainly interpreted languages can compete on speed, they don’t provide some magical fairy dust 50% speed improvement across the board. C# can compete with C++ after the JIT compiler is done, but there is no inherent magic that makes it better.

For the record, C# appeared in 2000. That’s 14 years ago for those of you counting. The C++ compilers have been being optimized for over 30 years.

But hey, if you want to believe Apple discovered the Holy Grail and its pixie dust performs miracles, go ahead and believe it, you won’t be alone.

chojin999

Swift it’s not an interpreted language. Heck you go around telling like it was some sort of Basic… please!
What the heck are you babbling about? I mean, really?
C# and Java will never match C/C99/C++/Objective-C and Swift.
Because Swift it’s not an intepreted language.
You clearly don’t know what you are you talking about. Or if you are doing that on purpose then you are really silly.

Tom Scharf

“like it was some sort of Basic” note the “let” statements in the screenshots, ha ha.

FTA: “your code is interpreted and rendered in a live “Playground” view in the Xcode IDE”

“Swift will also apparently bring a significant performance boost over Objective-C programs”

You need to really check into how JIT compilers work. It’s not magic, but a mature version can work on par with pre-compiled code. I’m not a big fan of JIT, but it has gotten markedly better over the past 10 years.

Code compiled to bytecode and intepreted by jit/runtime/whatever is still interpreted code – including Java and C#. I’m quite sure that Swift compiles to bytecode not to the executable (machine) code.

chojin999

And you are wrong. Swift uses ARC. Swift doesn’t run in any virtual machine. It’s just like a superset of Objective-C macros.
The whole realtime preview thing works with a “trick” to let developers code with it in XCode just like it was an interpreted language but IT IS NOT.

c_world_poster

Actually Java “can” be interpreted. (From stacktrack) It can be:
compiled ahead of time and executed as native code (similar to C++)
compiled just-in-time and executed
interpreted
directly executed by a supported processor (bytecode is the native instruction set of some CPUs)

angh

Java is interpreted as default; compiled to byte code and interpreted/run by runtime. Of course there are tools that can compile this to machine code, but that doesn’t have sense and it’s against the idea behind using Java in the first place. There are many languages compiled to the machine code, why not use them instead.
And I really have no idea why did they (apple) compared the speed to the python. And seems like python is not that slow anyway.

Daron Robinson

Swift is compiled, using a compiler based on the LLVM. Exactly the same as Objective C. Playground is an interpreted version provided simply for developer feedback using similar methods to to Xcodes code completion. Two different implementations.

c_world_poster

“C# and Java will never match C/C99/C++/Objective-C and Swift. “

They are only languages. The only speed related to them is coding. And C#/Java will probably beat the others (maybe not Swift) in that. And with the capabilities of the supporting frameworks and IDEs, probably even Swift.

“This analysis has shown that, in theory and practice, there is rarely any significant performance difference between native C++ and Java applications. And when there is a difference, the Java programmer reaps benefits the C++ programmer does not.”

Notice that this was written in 1998. JVMs have only gotten better. And there is more than one JVM.

But anyway … who cares? Well banks do. They use Java.

Anyway, Swift seems cool. About time.

TAH2

There are lots of speed implications of VMs and Garbage Collectors. I write in embedded systems. We would love a high level systems language, but we use C… because well it is really the only choice. We just implemented a websocket and HTTP server is C, it was about 20,000X smaller RAM footprint that a Node.JS solution.

If you look at performance bake offs, Java will be 2x slower, and 2x more memory on average. Not including the runtime VM of course. That is a lot to give up. It means that on average given the same processor and RAM a Android device has half the available resources. expensive trade-off for little benefit

chojin999

Exactly. It’s something people need to understand. Swift looks excellent because it’s the best possible compromise of the fastest possible C language without the C complexity.

c_world_poster

While I respect your experience in C and embedded and memory constraints, as I mentioned, there is more than one JVM and there is a JVM and also a Java language spec specifically for “realtime”. At some point and for some things, is C better? Yes. In others, is the JVM? yes.

From wikipedia “The RTSJ addressed the critical issues by mandating a minimum specification for the threading model (and allowing other models to be plugged into the VM) and by providing for areas of memory that are not subject to garbage collection,”

As for “bakeoffs”, No they don’t show Java will be 2x slower. Look at the link i posted somewhere here. And as for memory – You need to compare apples and apples – Most Java apps are written for maintenance which will tend to use more memory. Many “bakeoffs” show the opposite. It DEPENDS. Look at the link i posted below.

“Anyway, Swift is the first language I’ve seen in 20 years that could change the future of embedded systems work”

Again, Swift is just a language. Java is a language. And also a runtime. Java the language is NOT slow. I suggest that you look at some of the other JVM languages and compare them to Swift. You will see that … they look pretty much the same. And with some added tooling … so can Java (the language).
What really matters is the “output” after “compilation” and the “runtime”.

chojin999

Keep dreaming. In the real world no Java Virtual Machine is and will ever be as fast as optimized C/C++/Objective-C/Swift code.

The marketing did everything to sell the Java and .NET stuff over the years, the fact is that unless CPU manufacturers put some very fast hardware acceleration units for JIT in their products that is just not going to happen. And anyway even hardware virtualization support like the Intel VT-d and VT-x or the AMD-V always has some overhead.

c_world_poster

Again, you confuse language with runtime. And again, you look at one part and take it to be the whole. Things running in the VM have been proven to run faster than C. But as always – it depends. Is C faster than JVM code? Yes. Always? No.

Anyway, it seems Java converted to Android VM is fast enough. And that is what matters. As the TAH2 pointed out they need to sacrifice maintainability for speed. But that is seldom needed anymore. And definitively not in [most] iOS devices.

Lets says they are 100% faster when they are running. WGAS for most things.

chojin999

Proven by who? Sun ? Oracle ? Google ? You ? Please…
Obviously if code C/C++ the wrong way you can slow it down. So, what? What should that prove?
Bad coding it’s bad whatever language used.
Fact is that even with all the optimizations no virtual machine based languages like Java and C# .NET could be as fast as even not so much optimized C code. A few inline assembly optimizations in a C/C++ then would increase speed even further.

A VM will always be slower… it is a fundamental problem with VMs. Don’t get me wrong the java VMs are really good JITers… but that will never be native. Ever! No reason to argue that point. (see benchmarkgame.org for general comparisons).

Languages are designed around a premise. Many languages are designed around an interpreter (ruby/python), some of the feature set cannot be directly translated into full compilation, it wasn’t part of their design to be fully compiled (they could JIT). Java was designed around VM. It is limited by that premise.

But you misunderstand the importance of memory and performance in a mobile device which is similar to an embedded device.

Java is not, and can not be the answer. Besides Java is a odd place to argue from. It is not higher level or syntactically more awesome then C++ or objC. Its only claim to fame is write once, run anywhere via a VM. But that never proved out in the real world.

Ruby, Python, Haskell, Groovy on the other hand bring some awesome to the table. But they are all scripting languages, and cannot knock C off its perch as the dominate systems language. Swift can.

Daron Robinson

I’m genuinely curious, how do you see Swift working in an embedded environment? Wouldn’t there be other open source options that would be more suitable?

RestfullBull

I agree, maybe swift can similar to c in efficiency, but what about real-time determinism ?

Where did you get the information that Swift is an interpreted language from ?

BigInMemphis

At best C# runs at 30-40% of comparable C++ code. I have never seen a real case where C++ didn’t kick C# into the ditch. And you are correct, with C++ there are a lot of hardware and OS features that can be taken advantage of while at the same time C++ can be extremely portable if you sway away from some of it’s more byzantine constructs.

From what I can see Swift is native AND they have an available “VM” like environment for development … the best of both worlds.

Casey Henderson

this seems a lot more “thermonuclear” than the lawsuits the jobs was using. bravo, even as an android fanboy.

Daron Robinson

I don’t see this as about Android at all. It’s really just about shucking off legacy limitations and unnecessary code cruft.

sigaba

FTFA: ” In reality, Swift is very unlikely to be significantly faster than Objective-C. They are both statically typed, compiled languages — using the same LLVM compiler, no less.”

Objective-C is not a statically-typed language, it’s a dynamically-typed language with a message-passing object model. It’s quite believable that you could get a speedup from Swift if it replaces ObjCs message sends with method calls, notwithstanding Apple’s zany hacks to make objc_msgSend() run as fast as it does.

ObjC’s dynamic/duck typing also runs up against some fundamental brick walls when it comes to the optimizations LLVM can do, a strict static language like Swift picks up some benefits here too.

“To obtain such a graph, Apple probably had to choose an Objective-C feature that is known to be slow/buggy”

Yeah, like message sends :) The rub is that the whole language is built around message sends, you can’t use the object system without them.

Asdacap Cap

You sir, seems to know what you are talking about. Which makes me want to ask your opinion about Java. What do you think about it? Is it inefficient? Why is desktop application written in java seems to be slow? Does that effect android performance? Should Google figure out some alternative to Java?

c_world_poster

Because it is “seem” vs “is”. Many apps use Swing and people don’t use the right thread(s). So instead of the app “working” it seems to freeze.

Inefficient? Depends. I write and use desktop apps. They are not slow. They are efficient for me the developer. And most users have desktops /laptops that are mostly unused.

Androids have their own runtime. Java is just a language used to generated the bytes for the runtime. In fact, you can use most of the same code to generate native code for IOS apps (see robovm)

Google has plenty of languages. Dart, Go… The problem there is not the language. It is the runtime, the ecosystem and the community. Go look at apache.org and jboss and spring and netflix and linkedin. Look at Hadoop and ElasticSearch and etc.
Now, if you mean Java for Android, then, well again it is just a DSL for their runtime. With something like Eclipse’s Xtend, Java has all the syntactic sugar of Groovy, etc.

chojin999

“Androids have their own runtime. Java is just a language used to
generated the bytes for the runtime. In fact, you can use most of the
same code to generate native code for IOS apps (see robovm)” — What nonsense are you babbling about ?
You are really confused.

renan jegouzo

stupid analyse

chojin999

Swift has nothing to do with javascript, java, C# .. there is no virtual machine either.

c_world_poster

Except that they all are just Languages. The only thing that JS and Java and C# have to do with vms is that “they” (their bytecode, etc) TYPICALLY runs there.

chojin999

“Except that they all are just Languages.” — That means really nothing.

c_world_poster

I guess. If you ignore that they are all converted to something (well not scripting ones).

renan jegouzo

it’s a smart move from Apple, objective C was near obsolete, and for android, I just need a swift compiler for android (like xamarin with c#).

q n

Yeah, good luck with stopping Android. If the Mac is anything to go by, Apple is a company that makes niche products (at a very profitable margin), where most of that niche is located inside the US. Android, like Windows on desktop, is the only OS as far as most people are concerned.

Pete Morris

Clearly more people buy devices with Android installed. That’s absolutely true. What isn’t true is that people are concerned about the OS. People in the tech world are, but that is a tiny, and irrelevant, fraction of the customer base. 99.9% of people who buy these devices couldn’t care less about what OS it is running; in fact, most of them don’t even know what an OS is.

Ray C

This is not going to hold back Android. People who want to develop for Android will find a way.

chojin999

Developing for Android is a waste of time and resources. Piracy is king on Android, 90% of people pirate everything on Android devices and don’t want to even pay $1 for an app or a game.

The only profitable platforms for freelance developers, small software houses but large estabilished software houses too are iOS and Steam right now.
On Android the only profit can come from ads placed inside apps and games forcing people to pay something when using the free stuff on their devices, despite ruining the experience and overall product quality a lot.

Lew Ayotte

Apple Developer account is not free, it’s 99$/yr.

Giovanni Candido da Silva

My first languages are PHP, Javascript and Java. I thought Java was the best language until I start explore new paradigms and languages like Google Dart, Groovy, Kotlin, Scala, and others, and today I see a much in-depth picture.
Java, even the new huge step Java 8, is not so good after all (from a language perspective). I drop the first efforts to learn objective-c very quick, for me is a weird, difficult, and much ceremony syntax language, I have the same feel of moving bits, like assembly (just the feel of course), I like to think in a more abstract way.

Function programming, closures, a more concise object oriented, type inference, and other features are mind changing for a developer.

So, in my perspective swift language is a huge step forward. Huge enough to make me engage with apple development.
I believe the scale of changing is bigger than C to Java. Bigger because apple let pass 30 years of language evolution, and now is switching almost everything (Where is Futures? and Async?) in one announcement, without sacrifice performance. It feel like the Ipod of languages, and apple will try to push that way (from the perspective of revolution).

But I need to hands on this language and confirm my impressions.

ExtremeTech Newsletter

Subscribe Today to get the latest ExtremeTech news delivered right to your inbox.

Use of this site is governed by our Terms of Use and Privacy Policy. Copyright 1996-2016 Ziff Davis, LLC.PCMag Digital Group All Rights Reserved. ExtremeTech is a registered trademark of Ziff Davis, LLC. Reproduction in whole or in part in any form or medium without express written permission of Ziff Davis, LLC. is prohibited.