|
|
|
|
|
by fetbaffe
2095 days ago
|
|
Efforts like this with GraalVM and the upcoming JIT in PHP 8
should lead to, I believe, that many of the existing C extensions of PHP to be converted to pure PHP implementations. When you have a JIT based language you want as much to be executed in that language, jumping back and forth between PHP and C is a drawback from a JIT perspective. However there exist many PHP C extensions that are just thin wrappers around large C libraries like cURL, it is not really feasible to implement that in pure PHP. But with the introduction of a foreign function interface with PHP 7.4 that has made it possible to call C libraries with ease, as long the C library doesn't do too much macro magic, and to my understanding upcoming Java release ships with a much improved native bridge with better support for native types, these two thing could lead to, guessing here, that you only need to implement the bridge for each implementation but share the rest of the PHP wrapper code for that C library. However the foreign function interface introduced in PHP 7.4 is signigfanctly slower that the old style C extension of Zend PHP, but to my understanding is that future evolution of the JIT could theoretically reduce that performance impact. |
|
The Truffle solution to this is to run the C extension in the same JIT, so that's it's not a barrier to optimisation anymore.