A CPU will combine multiple transistors together to form logic gates. For example, we will take two binary inputs and validate that both are true to produce a true output, It only takes a few basic logic gates to solve highly complex computational problems. Modern chips contain billions of transistors and they can be flipped, on and off billions of times per second.
The state of the CPU is synchronized by an oscillator known as the clock generator. In general, the more times the clock can pulse per second the faster the CPU can compute and is normally measured in gigahertz. Gamers will sometimes overclock their CPUs to gain more performance at the cost of higher temperatures and a lower life expectancy.
In order to run applications, the CPU interacts with the system memory or RAM in a series of four steps known as the machine or instruction cycle,
1. Fetch phase
Step one is the fetch phase think of a software program as a set of instructions stored in the RAM the CPU has registers to temporarily store the address and memory that it wants to interact with. The program counter starts at 0 and copies that address to the memory address register. Then the control unit sends out a signal to copy the data from that address to the instruction register,
2. Decode phase
At which point it needs to figure out how to use this instruction in the decode phase. The control unit parses the actual bits in the instruction, most importantly the opt code contains the instruction like add or subtract and the operand is the address in memory to perform that operation on.
The final execute stage takes the decoded information and passes it as electrical signals to the relevant parts of the CPU. The arithmetic logic unit or alu can perform math on the data and then store the results in ram to change the state of the program.
The cycle is repeated billions of times per second and modern chips utilize multiple CPU cores to run multiple computations in parallel that’s how a CPU works.
Apple M1 vs Intel i9
In this section, we are going to learn about how processor architectures differ and also how those differences affect our productivity as developers and what the apple silicon chip and a refrigerator have in common, and then some of my own experiences with using developer tools and build execution on the first generation apple silicon chip called the m1 ship as compared to the intel chip.
Aside from human factors let’s dig deeper into why the new apple silicon machines have been really kicking up a storm and changing the industry software development included and spoiler alert. The m1 machines have been beating the intel machines in pretty much every build test that is thrown at it except a couple but it’s not all roses, so let’s talk about some downsides later.
Why is it so fast?
The first point that we want to discuss, is the physicality differences of the new apple silicon way, versus the old Intel and AMD way. This is what apple silicon, and your refrigerator at home, have in common.
Imagine for a minute that you want to make a turkey with cheese sandwich, you go over to the refrigerator and in one place, you have the turkey breast the cheese the mayonnaise the mustard, all those ingredients are right there in one place and you don’t have to run around the house to gather them you don’t have to drive to lots of stores to pick them up and this saves you lots of time and energy,
This kind of efficiency can be found in the new apple silicon chips because they aren’t just a new processor. Apple silicon is a collection of many chips that are housed inside one silicon container and this type of system is known as a system on chip or sock and it’s essentially an entire computer on one chip the main CPU the GPU the I/O controller the ML engine they’re all co-located.
So when the task is to make an electronic sandwich, so to speak or in other words to do some work that involves all these different components a system on chip is going to be a lot more efficient in terms of energy usage using only a tiny bit of power and at the same time it’s going to be faster than a typical machine that has all the components separate.
Intel-based machines have a CPU that’s a single chip and memory is located somewhere else on the motherboard, the I/O, or is somewhere else. The individual components might be even more powerful than the ones available at the moment on the latest apple silicon-based machines, but that comes at a cost.
Since these powerful components are like supermarkets that carry different sandwich ingredients. As a result, when you want a sandwich on an intel machine you’ll have to drive all over town because one store will have the turkey another store will have the cheese yet another store will have the mayonnaise each store might be really good at their own process and have the best ingredients.
But each store also takes a lot of power to run losing out on the efficiency, and since all you really want is just to make a simple sandwich, you’re wasting a ton of time and energy picking up the ingredients from all the different stores. Some might say the drawback with the system on chip design is that at least for now with the current selection of apple max you won’t be able to upgrade or change any of the components.
You get what’s on the menu and that’s it, but that’s not news to most people that are familiar with the apple ecosystem once you accept that idea you might even see the benefits of having a more efficient design where all the components are on one chip and they outweigh the cons and still provide better performance than the alternative.
How does this all affect real-world development workflows ?
So we have been doing a bunch of developer-focused tests on the latest apple silicon machines over as well as comparing them to other machines like the intel max and pc machines too and in general, the new design has been showing really great promise for my own workflows as a developer. There are lots of technology stacks that developers use.
It uses demo web apps to simulate their actions such as adding to-do items you visit the app in a browser of choice. We tried chrome and safari for this and you execute the automated test that runs through a collection of applications built with some of the more popular UI frameworks like angular react amber even vanilla js and jquery and a whole bunch more. This test reports the results as a single number when it’s done this number represents the runs per minute and the higher the better when it was finished we found that it had significantly more iterations on the m1.
While the 16-inch MacBook pro with the intel core i9 processor did beat the MacBook air with the m1 chip it really didn’t do so by a lot and when you consider the price differences between the machines and the fact that the m1 stayed cool throughout the test and that the battery hardly even took a hit on the m1 you might be thinking whether the extra few seconds saved while running this benchmark on the intel i9 is really worth the money so running benchmarks is often very telling but it doesn’t necessarily line up with real-world scenarios.
Best Dev Stacks for M1
We ran a few Xcode builds and swiftly builds and we did some C++ algorithms and built OpenCV and WebKit in all those tests the m1 came out on top. What dev stacks benefit the least so far in our own testing any builds that have to do with running natively built software and building using native tooling has absolutely destroyed intel and speed and battery performance.
Native being compiled for the apple silicon architecture even when running some software via apple’s rosetta, that’s the translation layer that allows you to run intel and AMD based x64 and x86 programs on the new Apple hardware even some of those software packages ran better than on intel.
Worst Stacks for M1
There are workflows that aren’t ready yet. If you are an android developer android studio and official android emulators work on apple silicon but they’re currently using rosetta for translations and while rosetta is generally pretty good at running x86 targeted code on arm chips it’s not enough for the CPU hungry android workflows.
We found the results to be not very usable at the moment the latest version of dot net which is version 5 right now isn’t fully supported to run on arm simple console applications run just fine but testing any web workflows like asp.net core doesn’t work at all yet. Now it’s expected that by the end of this year .net six will come out, it’s in alpha right now and we’ll have full support for arm until then if you need to develop.net apps we suggest using a pc with windows.
If you think you can use a virtual windows machine, we have tested this as well Parallels is the only vendor that currently supports the m1 chip to create a virtual windows environment but the issue is that the windows guest operating system for arm is still quite immature and needs a lot of work also.
Visual studio 2019 the latest visual studio offering from Microsoft is unfortunately not compatible with arm at all and the test is not stable even using the built-in windows translation of x64 software to run on arm hardware. For game developers that use unity and we are pleased to say that it works surprisingly well on apple silicon via rosetta. However, it’s not as performant as running natively on x86. Right now at this time of writing this article, Unity might have a version natively compatible with m1, which we know they’re working hard to get out as soon as possible.
Apple silicon has really put a boost into many workflows for developers and other professions and eventually even gaming and with the m1 tests, we’re seeing the improvements with just their entry-level machines. The upcoming second and third-generation apple silicon machines will be even more performant and we think it’s really gonna help us as developers move to the next level and we think it’s just gonna lift up the entire industry to follow the updates on the new apple silicon chips as they relate to us. If you like this article, share this with your friends and support us for our upcoming articles.
Leave a Comment