Can PHP Script a Big Data Comeback?
PHP is widely known as an interpreted language. But with PHP version 8, the language was given a Just In Time (JIT) compiler. According to PHP folks at Zend, that JIT compiler could pave the way for PHP to be more widely used for big data and machine learning workloads.
PHP crashed the IT scene in the early 2000s, when the scripting language surged in popularity. Large numbers of Web developers adopted PHP to help them build Web 2.0 applications as part of the emerging LAMP (Linux OS, Apache Web Server, MySQL database, and PHP) stack (although the “P” in LAMP could also refer to Python and Perl).
But the addition of the JIT compiler could script a change in usage patterns for PHP. That’s according to Matthew Weier O’Phinney, a principal engineer at Zend (now owned by Perforce) and the owner of the Laminas Project (formerly the Zend Framework).
“JIT compiling is going to open up the possibility of PHP to move into the systems programming landscape, as well as to move into the machine learning and big data landscape,” he said in a recent webinar.
The addition of JIT compiling will significantly speed up the data processing speeds and response times of PHP applications, Weier O’Phinney said. Instead of waiting to see if a given scripts already exists in the OPcache and then performing a number of steps to obtain it, parse it, compile it, and then execute it, the JIT compiler skips a number of those steps and simply executes the script (if it exists in the OPcache, that is).
“We don’t even have to compile the OPcode to machine code,” he says. “We just execute the machine code, so you skip all the most expensive portions of processing that incoming request.”
That speedup will come in handy for machine learning and big data workloads, which requires a program to quickly process large amounts of incoming data. The language C is a favorite among machine learning engineers because of its speed. Rust is often compared to C because of its speed. And everybody loves Python these days, if not for its relatively simple syntax, then for the fact that it possesses native C bindings, “so it can actually compile its own code down into C-level or execute C libraries directly,” Weier O’Phinney says.
“PHP with JIT now gets that kind of speed, if not faster,” he continues. “It’s able to do it faster than Python and it’s closer to Rust or C in that particular case, which means we can have an open API endpoint that’s taking stuff constantly and is able to process it through the machine learning rules and categorize it so people can analyze it later.”
PHP version 8 was released in November 2020, so it’s still fairly new. For more information, see www.PHP.net.