viernes, 13 de septiembre de 2013

A Developer's Guide to Apple's 64-Bit A7 Chip

One of the biggest surprises at Apple's iPhone 5S event was the news that the A7 chip inside the phone is 64-bit. Apple touts its new A7 chip as having "desktop-class architecture."

This 64-bit processor — a first we've seen in a smartphone — means apps can now run and be written in 64-bit. In theory, applications can run faster and be more energy-efficient. We've already heard from the gaming community about their take on 64-bit (along with the other graphical improvements to the A7 chip), and the on-stage demo of Infinity Blade III looked stunning.

That's all great, but what does 64-bit really mean for you, the consumer? And if you're a developer — will you need to start converting your app to 64-bit right now?

64-Bit Computing in the Age of Mobile

Without getting into too much about how microprocessors work, the basic idea behind 64-bit processors is that they can address more memory. With that extra memory, more complex software — whether it's graphical or deeply computational — can run better and faster while consuming less power.

In the desktop world, the move to 64-bit was essential because it allowed applications and operating systems to access more than 4GB of RAM. This was crucial, especially in gaming and in graphical applications.

In mobile computing, the advantages of 64-bit are a bit different. Mobile computing is advancing at an insanely fast pace, but we're still a long way off from any phones shipping with (or supporting) 4GB of RAM. Moreover, adding a ton of RAM to a phone isn't a great idea because RAM sucks power and that means you have less battery life.

So if not for the 4GB limit, why bother with 64-bit on mobile? This subject came up quite a bit last month, when rumors of a 64-bit A7 chip first surfaced.

The first thing to understand is that having a 64-bit processor means the chip can get more performance per watt. In other words, apps and tasks won't drain the battery as quickly.

This is especially true when it comes to games. The biggest graphical improvements might come by way of the A7's new GPU, but even games that don't have millions of pixels and "console quality" graphics can benefit from a more power-efficient processor. If you've ever played Candy Crush Saga and watched your battery die before your eyes, you know that even simple games can be total power hogs.

Still, the big story with 64-bit is that even if we don't see any immediate benefits today, the future potential is massive.

Which Apps Should Target 64-bit?

All right, so what types of apps and app developers will see the most immediate benefits of 64-bit?

"The two types of apps that benefit most [from 64-bit] are games and scientific/number-crunching apps," says Jonathan Wight, a veteran iOS developer. Wight cites Chris Liscio's music app, Capo as an app that could probably benefit from 64-bit.

Bryan Lahartinger, software engineer at Vouc.hr agrees, saying "Apps that might benefit include graphically intense games (Infinity Blade III, trailer below) or anything that is doing a lot of number crunching, like a music synthesizer (Ocarina)."

"I think most apps won't benefit," Wight says — at least for now. Still, that isn't to say that 64-bit won't have any advantages. "I think the OS as a whole will benefit and the entire device will feel better, especially with the handling of background tasks."

Additionally, not all apps will necessarily see any benefits from a 64-bit switch at all (not yet at least). Lahartinger notes that some apps might face "potential memory footprint issues" with a 64-bit transition. "For apps that haven't optimized their memory usage, this could impact app speed or how much memory is available for other iPhone apps to use." he says.

Fortunately, Apple has outlined the process of converting an app to 64-bit (Apple Developer account required), including an entire section on how to optimize memory performance.

Apple is also requiring that all developers who submit 64-bit apps also support the 32-bit runtime.

Getting Started With 64-bit

Rather than immediately focusing on compiling apps for 64-bit, Abhi Patwardhan, the CTO of mobile development shop Gist Digital, says developers need to make sure their apps are ready for iOS 7.

"The first thing devs need to do is focus on updating for iOS 7 and its design changes," he says. "The second stage is 64-bit using Xcode 5, and to read all the developer documents."

And even if an app won't see a seismic shift in performance by moving to 64-bit, it's not a bad idea to start considering a move. Lahartinger says that its relatively easy for developers to get started and "take advantage of some of the 5S 64-bit features right away," noting that this "will mostly help their apps perform even better."

He offers some advice for developers considering a move: "There are a bunch of things to consider during the switch around data type sizing and how that impacts the performance of an app. Not all apps will perform better but in most cases impact will be at worst par."

Most developers will need to wait until Sept. 20 to test 64-bit on the real iPhone 5S hardware. Every developer I've spoken with agrees that the conversion to 64-bit on the app side won't start in earnest until after the iPhone 5S is out.

iPhone 5S

Potential for a Unified OS X/iOS World

iOS and OS X are both based on the same core operating system and kernel. Still, the two operating systems work differently and handle data and code in slightly different ways.

In recent years, we've seen more of an iOS influence on OS X, while also seeing more OS X-influence on the back-end APIs in iOS.

One of my first thoughts when Apple announced that the A7 was 64-bit was, "I wonder what this means for a unified OS strategy?" — especially if ARM processors are able to improve to the point that they could run desktop OS X apps as well as an Intel chip.

When looking over Apple's 64-bit iOS 7 documents, I found this very interesting sentence (emphasis mine):

The architecture for 64-bit apps on iOS is almost identical to the architecture for OS X apps, making it easy to create a common code base that runs in both operating systems.

Now this has potential. Even though iOS and native OS X apps both generally written in Objective-C — using the Cocoa and Cocoa Touch frameworks — it's not always easy for developers to share code between the two platforms.

If what Apple has written in its developer docs is any indication, it's possible that a move to 64-bit might mean that Mac app developers could more easily bring some of their apps to iOS — or vice versa.

That could have huge potential, especially on larger devices such as the iPad. Imagine having a more powerful graphics app — such as Pixelmator or Acorn — on iOS.

Don't Believe the Un-Hype

Lots of pundits are dismissing 64-bit as being "unimportant" for now. This is despite the fact that the same critics praise the existence of quad- and octa-core smartphones (never mind that most apps aren't written to use more than two cores — apparently raw theoretical speed trumps actual performance).

Although no one is arguing that all iOS apps will transition to 64-bit overnight — and keep in mind that the iPhone 5S is the only iOS device with a 64-bit chip; it'll be years before Apple's entire product line is 64-bit — ignoring the importance is a mistake.

Even if we assume that for the first little while, only number-crunching and graphically intensive apps will benefit, think about what that does for the potential of the app ecosystem as a whole.

I can't wait to see developers who have previously been afraid of making a mobile app — for fear of running up against processor limitations — of taking on the new power of 64-bit and bringing desktop-worthy apps to the small screen.

Image: Apple

No hay comentarios:

Publicar un comentario