Open arshidkv12 opened 9 months ago
The difference in speed is likely due to converting between PHP types (Zval
) and Rust types such as String
, Vec
, etc.
I think to test this assumption it could be a good idea to benchmark:
#[php_function]
fn should_be_fast(&Zval zval ) -> Zval {
zval.shallow_clone()
}
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 Vec<T>
allocations, etc?
I'm not sure, I think the #[php_function]
may generate code that has additional allocations etc in.
Hi I tested with xdebug profile option with grind cache. Functions are slower than c. How to speed up?