Details
-
Improvement
-
Resolution: Fixed
-
Major
-
None
-
None
-
None
Description
At the moment part of the SDK written in PHP, but because we cannot mix php and C code in the extension, we do some trick: every time the PHP class updated, the special script (genphpfile.sh) executed to concatenate all the PHP files and render them into C header file as a char* literals. And then load them in the runtime. The only problem with this approach is that, there is no any other place to eval those strings except REQUEST_INIT hook in php extension, and this is a huge performance bottleneck (and users know about it already: https://forums.couchbase.com/t/performance-issues-with-loading-php-sdk-in-php-fpm/8348/7
As one solution would be to keep everything as is, but improve generator so that it will generate classes in C (for example using https://github.com/nikic/PHP-Parser). Another appoach would be to get back to previous process, when we have PHP files only for autodocs and tests, and everything written in C.