What Software Engineers can learn from Apple's M1 Chip

As a software engineer, I’ve had the opportunity to see many software and hardware technologies introduced over the years. Beyond writing code, I also work as an educator, teaching computer science essentials to other iOS developers. Back when I started, the Java programming language was just released, and the possibilities of the internet were being realized with the launch of Mosaic and Netscape. It was the golden age of the x86 platform, including countless PCs being sold with 386, 486, and Pentium processors.

Fast forward to today, and much of the innovation seen is on mobile devices. While we were amazed by the original form factor of the iPhone (and later the iPad), it’s what’s being done on these devices today that is truly surprising. More than just photos, any device from the iPhone or iPad family (e.g., Air, Pro, etc.) can easily support document creation, gaming, video editing, video production, and more. As many fans and industry experts have anticipated, most mobile devices can now meet or exceed their desktop counterparts’ performance.

Measuring Software Performance

Software developers write code and build things. When building something new or even making incremental improvements, we are often faced with the best way to write a function or sequence. Mostly, decisions are chosen based on the time it will take for an algorithm to execute or the storage space the solution will occupy. This performance is measured using a standard called Big-O Notation.

When teaching Big-O Notation basics, I often emphasize that one doesn’t improve an algorithm’s performance through increased hardware. For example, if a typical Google search occurred in O(n) — linear time, any increase in computing speed or capabilities would merely be covering up a design in need of a complete overhaul. For example:

Like this article? Get more content like this when you sign-up for the weekly iOS Computer Science Lab.

extension Array where Element: Comparable {

      //brute force approach..
      func linearSearch(for evalue: Element) -> Bool {
                
        //check all possible values
        for number in self {
            if number == evalue {
                return true
            }
        }        
        return false        
    }
}

While the concept of an O(n) algorithm can take many forms, the easiest to understand is a basic for loop. What’s interesting is that there’s nothing technically incorrect about this code. It works fine and, in many cases, could provide an optimal solution — especially if we were attempting to optimize a complex system or recursive algorithm. However, when considering the functions’ intended result (e.g., Search), there are many techniques we could apply to improve the design. When considering computer hardware, this connection between performance, design, and optimization has also been at the forefront of Apple’s M1 Chip.

Performance Reimagined

The results are in, and experts across the board are blown away by M1. So much so, many are seeing it as a revolution in computing. However, the question of performance has two parts. Has Apple introduced some new revolutionary new technology, or have they revealed the potential of existing technologies when correctly optimized?

Even though I’ve tinkered with a few PCs over the years, I certainly wouldn’t consider myself a hardware expert. However, it’s clear Apple’s M1 is the result of small steps versus a single monumental change. Noticeable improvements with battery life, performance, and low power consumption are questions Apple has been working through for over a decade with its consistent focus on mobile. Contrary to desktop devices, the idea of adding a cooling fan or expandable RAM (Random Access Memory) to an iDevice seems ridiculous — mainly because the increased bulk would render the device pointless. Expanding on these lessons learned, it would appear the best way to optimize a computer is to centralize its essential components (on the CPU), rather than to spread its responsibilities to other areas.

Desktop Redesign?

Could the trusted x86 platform so many of us have used for years be flawed? While flawed may be too harsh to describe, the term “in need of disruption” may be more applicable. For decades, a hallmark of computing ownership has been to ensure a system could be expanded to 32, 64, or even 128GB of RAM. While user-upgradeable RAM has been a nice feature, this could signal a computer isn’t as optimized as it could be — darn.

The proof can be seen in the results. Ironically, my new 2020 iPad Air has the best CPU performance in my household, beating an iMac, MacBook Pro, as well as a (2010) MacBook Air, hands down. Seems like a good time for an upgrade.