Improving Performance of PHP for Arm64 and Impact on Amazon EC2 M6g Instances
idk.dev
idk.dev
I haven't been this exited about hardware in a long time. Maybe it's because of my Raspberry Pis, but I'm childishly giggly.
Also, it's clear Intel rested on their laurels and resisted real innovation for a long time. Now with heavy hitters entering the field (Apple, Amazon, etc), hopefully we see some real innovation in this silicon space.
What I'd like to see is SoCs with accelerated AI chips, similar to what's in the recent iPhones. If that type of hardware becomes widely available on the macs we almost all of us in SV develop on, then the libraries will follow.
Fortunately, we have data to confirm our suspicions: https://insights.stackoverflow.com/survey/2020#technology-de...
Windows 45.8%
MacOS 27.5%
Linux 26.6%
BSD 0.1%
Huh, I didn't expect the split to that even. That's pretty gratifying, in my opinion. That's far, far closer to 33% per major platform than I thought possible. (all possible apologies to the BSD demons out there, we love y'all and I wish it were more like 25% per major platform, all 4 of them)I am starting to wonder if Apple timed this all along or did the two ARM announcement all within 6 months happens to be coincidence.
"There are two other patches that impact the performance of the WordPress-NGINX benchmark, and both have been applied to master and PHP-7.4 branch:"
A patch to disable the use of huge pages in memory allocator fixed a 10% performance regression: https://github.com/php/php-src/commit/928c42211f737640e4dc3c...
The patch to enable the Zend Optimizer on ARM64 accounts for about 5% of better performance on M6g instances https://github.com/php/php-src/commit/4d7df449d0ab389b01b45f...
I'm confused when they say it's based on LuaJIT? Do they mean PHP is being transcoded to Lua and run by LuaJIT.
Or do they mean that PHP-JIT is based on "DynASM" - which is a subproject of LuaJIT?
Quoting: "PHP-8 plans to feature a new JIT compiler that optimizes the PHP byte-code in the Opcache. The JIT is currently developed on x86 and is based on Lua’s JIT. As Lua’s JIT supports ARM64, we work with PHP developers to enable and to tune the Opcache JIT in PHP-8 to get the best performance on AWS Graviton processors."
But "just" putting encoded instructions in a memory buffer is the easy part of it all, and that's all DynASM does. You still need thousands of lines of code backing it up to actually generate the right instructions, and implement appropriate optimizations.
But PyPy has an arm64 JIT since last year: https://morepypy.blogspot.com/2019/07/pypy-jit-for-aarch64.h...
There is some information about Python optimization, especially for data science type applications, in our getting started guide: https://github.com/aws/aws-graviton-gettting-started/blob/ma...
1. Amazon
2. Apple
3. ?? Add your here. :)
Amazon is pushing ARM64 optimization because they make their own chips, and squeezing more juice from them is a way to extract more revenue from their initial investment.
It's good to have a choice
RISC-V Dual-Core 64-bit, with FPU and some 'machine learning' accelerator
or cheaper https://www.seeedstudio.com/Sipeed-Longan-Nano-RISC-V-GD32VF...
You still can get linux on the K210 https://www.cnx-software.com/2020/02/17/how-to-build-run-lin...
and it seems it's mainlined now: https://www.phoronix.com/scan.php?page=news_item&px=RISC-V-C...