03-15-2018, 06:48 PM
So, I was bragging about the power of ARM in the discord today, and I figured I'd share something with you. Here's a simple snippet of x86 code
and the equivalent for ARM
Now, these two are completely identical when it comes to what they do, but they are worlds apart when it comes to resources consumed. We'll start with the x86 one.
Clock cycles:
The total one-time pass through this program (that is starting from .top until we get back to .top is 6 clock cycles, and it takes up 9 bytes in memory.
Now, with ARM this is simple. Every instruction takes 1 cycle and takes up 4 bytes. So, total time is 2 clock cycles and takes up 8 bytes in memory.
This means, that the ARM program will run in 4 fewer CPU cycles, using 1 byte less memory. Now, this being a small example the power of ARM isn't embodied much in the memory (I'm actually impressed its fewer at all for this program), but it's a massive difference in run time.
Scenario: an x86 CPU running at 1Hz and an ARM CPU running at 1Hz
Time needed for x86 cpu to complete one loop: 6 seconds
Time needed for ARM cpu to complete one loop: 2 seconds
Now that's a massive difference, but sure, the frequencies are ultra low. Let's use a different example:
x86 CPU is running at 3GHz
ARM CPU is running at 1GHz
Run the loop 10,000 times. Which CPU will finish first?
The answer: they will TIE.
This shows the massive difference. The amount of work you can do with a single core 3GHz x86 CPU is THE EXACT SAME amount of work you can do with a single core 1GHz ARM CPU (in this example, ARM takes a bigger lead as the program gets more complex). Now think about it. Your phone probably has a 4+2 ARM CPU, meaning that it has 6 cores total, 4 probably running at 1.4GHz (probably faster though), and 2 running at half of that (700MHz). In comparison, you might have a desktop PC with a 3.5GHz quad core processor, which is an x86 one. If you were to run all of your software, OS, games, whatever on the CPU in your phone (assuming they were written for ARM, and not just ported), then it would be slightly (7 - 15%) FASTER than your desktop PC.
This means, that your phone has MORE computing power than your "high end" PC. It's an interesting thought to think about.
Hidden Content
and the equivalent for ARM
Hidden Content
Now, these two are completely identical when it comes to what they do, but they are worlds apart when it comes to resources consumed. We'll start with the x86 one.
Clock cycles:
Hidden Content
The total one-time pass through this program (that is starting from .top until we get back to .top is 6 clock cycles, and it takes up 9 bytes in memory.
Now, with ARM this is simple. Every instruction takes 1 cycle and takes up 4 bytes. So, total time is 2 clock cycles and takes up 8 bytes in memory.
This means, that the ARM program will run in 4 fewer CPU cycles, using 1 byte less memory. Now, this being a small example the power of ARM isn't embodied much in the memory (I'm actually impressed its fewer at all for this program), but it's a massive difference in run time.
Scenario: an x86 CPU running at 1Hz and an ARM CPU running at 1Hz
Time needed for x86 cpu to complete one loop: 6 seconds
Time needed for ARM cpu to complete one loop: 2 seconds
Now that's a massive difference, but sure, the frequencies are ultra low. Let's use a different example:
x86 CPU is running at 3GHz
ARM CPU is running at 1GHz
Run the loop 10,000 times. Which CPU will finish first?
The answer: they will TIE.
This shows the massive difference. The amount of work you can do with a single core 3GHz x86 CPU is THE EXACT SAME amount of work you can do with a single core 1GHz ARM CPU (in this example, ARM takes a bigger lead as the program gets more complex). Now think about it. Your phone probably has a 4+2 ARM CPU, meaning that it has 6 cores total, 4 probably running at 1.4GHz (probably faster though), and 2 running at half of that (700MHz). In comparison, you might have a desktop PC with a 3.5GHz quad core processor, which is an x86 one. If you were to run all of your software, OS, games, whatever on the CPU in your phone (assuming they were written for ARM, and not just ported), then it would be slightly (7 - 15%) FASTER than your desktop PC.
This means, that your phone has MORE computing power than your "high end" PC. It's an interesting thought to think about.