Skip to content

Implement optimization to cast values instead of verifying the type#21627

Draft
Girgias wants to merge 6 commits intophp:masterfrom
Girgias:optimize-zend-verify-return-type
Draft

Implement optimization to cast values instead of verifying the type#21627
Girgias wants to merge 6 commits intophp:masterfrom
Girgias:optimize-zend-verify-return-type

Conversation

@Girgias
Copy link
Copy Markdown
Member

@Girgias Girgias commented Apr 3, 2026

I came up with this idea while working on #21580, but no idea if this is a safe way to write an optimization clearly not because it seems to segfault everything.

Copy link
Copy Markdown
Member

@ndossche ndossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't work because you need a result var. Furthermore the op handler destroys OP1 after setting the result, so they can't use the same TMP

@Girgias
Copy link
Copy Markdown
Member Author

Girgias commented Apr 10, 2026

Attempting a new approach suggested by Arnaud to instead use VM specializations.

I might revert the string one and just have a generic one as it's getting kinda complicated...

@Girgias Girgias force-pushed the optimize-zend-verify-return-type branch 6 times, most recently from d529eaf to 82ad073 Compare April 10, 2026 18:21
@Girgias Girgias force-pushed the optimize-zend-verify-return-type branch from 82ad073 to 6cf5401 Compare April 10, 2026 19:15
@github-actions
Copy link
Copy Markdown

AWS x86_64 (c6id.metal)

Attribute Value
Environment aws
Instance type c6id.metal
Architecture x86_64
CPU Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz, 64 cores @ 2900 MHz
CPU settings disabled deeper C-states, disabled turbo boost, disabled hyper-threading
RAM 251 GB
Kernel 6.12.66-88.122.amzn2023.x86_64
OS Amazon Linux 2023.10.20260202
GCC 14.2.1
Time 2026-04-10 19:50:47 UTC
Job details https://github.com/php/php-src/actions/runs/24261213322 (Artifacts)
Changeset https://github.com/php/php-src/compare/663efacb91..6cf5401ad9

Laravel 12.11.0 demo app - 50 iterations, 50 warmups, 100 requests (sec)

PHP Min Max Std dev Rel std dev % Mean Mean diff % Median Median diff % Skewness Z-stat P-value Memory
PHP - baseline@663efac 0.38778 0.38910 0.00029 0.07% 0.38829 0.00% 0.38828 0.00% 0.878 0.000 1.000 25.31 MB
PHP - optimize-zend-verify-return-type 0.38489 0.38784 0.00045 0.12% 0.38554 -0.71% 0.38546 -0.73% 3.095 8.600 0.000 25.29 MB

Symfony 2.8.0 demo app - 50 iterations, 50 warmups, 100 requests (sec)

PHP Min Max Std dev Rel std dev % Mean Mean diff % Median Median diff % Skewness Z-stat P-value Memory
PHP - baseline@663efac 0.66269 0.66406 0.00032 0.05% 0.66311 0.00% 0.66306 0.00% 1.375 0.000 1.000 25.26 MB
PHP - optimize-zend-verify-return-type 0.65845 0.66408 0.00103 0.16% 0.65922 -0.59% 0.65883 -0.64% 3.019 8.269 0.000 25.25 MB

Wordpress 6.9 main page - 50 iterations, 20 warmups, 20 requests (sec)

PHP Min Max Std dev Rel std dev % Mean Mean diff % Median Median diff % Skewness Z-stat P-value Memory
PHP - baseline@663efac 0.58456 0.58881 0.00084 0.14% 0.58540 0.00% 0.58514 0.00% 2.474 0.000 1.000 25.22 MB
PHP - optimize-zend-verify-return-type 0.58409 0.58678 0.00062 0.11% 0.58479 -0.10% 0.58457 -0.10% 1.729 5.325 0.000 25.27 MB

bench.php - 50 iterations, 20 warmups, 2 requests (sec)

PHP Min Max Std dev Rel std dev % Mean Mean diff % Median Median diff % Skewness Z-stat P-value Memory
PHP - baseline@663efac 0.44436 0.44656 0.00048 0.11% 0.44562 0.00% 0.44560 0.00% -0.195 0.000 1.000 25.22 MB
PHP - optimize-zend-verify-return-type 0.44679 0.44952 0.00050 0.11% 0.44787 0.51% 0.44782 0.50% 0.668 -8.614 0.000 25.27 MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants