Review: Xcode 5 makes better, faster, stronger iOS and OS X apps

Major upgrade to Apple's IDE scores high with faster compiling, 64-bit support, easier debugging, source control integration, and automated testing

Page 2 of 3

For Xcode 5, the auto layout mechanism has been much improved. IB now lets you more accurately specify how elements can be constrained (say, several buttons must remain in a line) and how they are free to move about (these buttons are free to move up and down the screen's vertical axis). Apple emphasizes that you should use auto layout going forward, which is a big hint that devices with different screen sizes are forthcoming.

Making it faster

The compiler's code generator has been tuned to emit optimized ARMv7s instructions for iOS apps. Using these optimized instructions, Apple has seen a boost in execution speed of apps ranging from 15 to 30 percent. The LLVM compiler also better supports SIMD (single instruction, multiple data) instructions such as ARM's NEON and Intel's AVX2, which is in Intel's new Haswell CPU. The SIMD support enables the compiler to implement an autovectorizer, an optimization technique that translates certain compute-intensive loops into SIMD instruction sequences that operate on multiple chunks of data (instead of one) with each loop iteration. Depending upon the code, Apple saw performance boosts ranging from 1.5x to 7.9x.

The compiler also generates 64-bit instructions that improve computational performance, especially when used on the 64-bit A7 CPU in the iPhone 5s. The 64-bit tool support is also necessary to build iOS 7, which is now a 64-bit OS. Taken together, the CPU, OS, and tools should enable a new category of applications that use complex algorithms to manipulate large data sets.

C++ programmers, Apple has not forgotten you. Continuing its steady addition of C++ v11 language features to the tools, Apple has included support for user-defined literals, generalized attributes, inheriting constructors, alignment declarations, and unrestricted unions with this release. This brings Xcode 5 into almost full compliance with the C++ v11 standard. Note that Apple's LLVM C++ standard library is required to access the latest C++ v11 features and all-new Cocoa frameworks.

More productive programming

Faster code, if not written properly, simply crashes faster. The Xcode 5 debugger has improvements that should make it easier to find bugs in your code. The debugger has a data tips feature that displays the contents of that variable when you hover the pointer over a variable name. If the variable is a complex structure, the data tip unravels it to display the individual elements in the structure. You can then use the data tip to explore the values of the elements.

The data tips feature is not new, but new to Xcode 5 is how this feature now extends to graphic data: If the item is a view that contains a rectangle, a Bezier curve, or a pixel image, the graphic is displayed. This combination data/graphic display lets you confirm that all elements have the values (or graphics) that you expect. If not, it's time to investigate why.

The debugger now has lightweight real-time gauges that display specific attributes of the app's operation, such as CPU and memory usage, as it executes. Gauges for iCloud connections, energy consumption, and OpenGL ES operations are also built in to the IDE. These gauges consume less than 1 percent in overhead so as not to affect the app's behavior. 

As your program runs, the gauges appear as simple moving bar graphs that can make a sudden spike in CPU cycles or a slow memory leak evident at a glance. Clicking on the bar graph generates a more detailed report such as current CPU and peak CPU usage. If the problem is not apparent, you can click on a button that brings in the heavy artillery -- the Instruments utilities -- for a deep and detailed (and more invasive) examination as the program continues to run. Gauges are also good at helping you fine-tune your app's performance and minimize its CPU usage and battery consumption.

Xcode 5
Gauges are lightweight processes that monitor your app's use of CPU, memory, graphics, and other resources. Looks like I have a memory leak.
| 1 2 3 Page 2
From CIO: 8 Free Online Courses to Grow Your Tech Skills
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.