-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slower Than C #310
Comments
The difference in speed is likely due to converting between PHP types ( |
I think to test this assumption it could be a good idea to benchmark:
I suspect we might actually have several inefficiencies in the calling bridging, unnecessarily allocating etc. |
That would just be benchmarking a direct clone of a Zval though right? Not the |
I'm not sure, I think the |
The current approach is expected to introduce some performance overhead: Calling a function from a wrapper function. I'm not sure how common this case is, but if necessary, it's possible to create a function without a wrapper and work directly with zend_execute_data* execute_data and zval* return_val. |
For calling functions more efficiently i use something like this: https://github.com/Xenira/php-iter-tools/blob/rust-impl/src/lib.rs#L1739 |
I think zig is best for it https://github.com/arshidkv12/zig-php |
export fn hello_world(execute_data: ?*php.zend_execute_data, return_value: ?*php.zval) void {
_ = execute_data;
_ = return_value;
_ = php.php_printf("Hello from ZIG!\n");
} That's exactly what I'm talking about – the same code can be written in Rust without any performance loss. We need to consider this implementation option. |
Hi
I tested with xdebug profile option with grind cache.
Functions are slower than c. How to speed up?
The text was updated successfully, but these errors were encountered: