-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
reli-prof
A sampling profiler or a memory profiler for PHP written in PHP, which reads information about running PHP VM from outside the process. You can find performance bottlenecks or memory leaks of your scripts without changing the target script or loading extensions.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
The introduction of FFI in PHP was done with the reference to LuaJIT. As a result, FFI's CData is a completely dynamic type, similar to stdClass, and does not get proper support from the IDE or static analysis. For this reason, php-fuse has introduced a muddy mechanism to map CData to PHP classes. https://github.com/sj-i/php-fuse/tree/master/src/FFI It is a shame that CData is such a dynamic type since PHP nowadays is a language that easily benefits from static types, unlike Lua or Ruby. I'm hoping that I or someone else can come up with a better solution, such as allowing C types to be mapped to user-defined CData subclasses, as the idea was seen in the early discussions when FFI was introduced. https://externals.io/message/102036#102050
Well, one need do nothing more than look at the list of fuse-powered filesystems to get some ideas of why: https://github.com/libfuse/libfuse/wiki/Filesystems
There are a few things about FFI that bother me, though not so much the problems. These are things that I found a bit annoying, not only in this project but also in my experience with another project (https://github.com/sj-i/php-profiler). Let me try to share some of them with you.
The other thing that bothers me is that most of the function arguments in FFI are ZEND_SEND_PREFER_REF, which sneakily tries to change the type of value I pass as an argument. This is not a documented behavior either. https://github.com/JetBrains/phpstorm-stubs/pull/777#issuecomment-620589391
So far this has not been a major issue in this project, but as mentioned in the RFC and the original FFI repository, the use of PHP callbacks involves leaks until the end of the process. https://wiki.php.net/rfc/ffi#php_callbacks https://github.com/dstogov/php-ffi#php-callbacks There is no detailed description of the leak, but it is probably the same problem as in LuaJIT. https://luajit.org/ext_ffi_semantics.html#callback_resources If you are using a few callbacks during a process execution, as in the php-fuse example, it seems to be okay. However, for example, if you try to use qsort() in a loop, the leakage caused by callbacks may be problematic. As in the case of LuaJIT, it is probably needed to provide an API to explicitly cast the callable to a function pointer that can be called from the C side, and also to provide a way to manually release it.
Related posts
-
Reli 0.9.0 is released with a memory profiling tool
-
Show HN: Reli – a VM state inspector written in PHP for PHP
-
sj-i/php-profiler: a sampling profiler for PHP written in PHP
-
Database Abstraction Layers: I absolutely love $wpdb php class from Wordpress, why does nothing like this exist? Is Laravel similar?
-
Random shower thought I got: PhpStorm developers are Java developers who know PHP better than most PHP developers