Skip to content

zend_execute: Mark zend_get_executed_*() as __attribute__((pure)) #18998

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TimWolla
Copy link
Member

@TimWolla TimWolla commented Jul 1, 2025

These functions do not modify the state of the program and depend on thread-safe global variables only.


This is a possible precursor to #18995.

@TimWolla
Copy link
Member Author

TimWolla commented Jul 1, 2025

CI Benchmark indicates a slight slowdown. Can anyone with a “reliable CPU” do another non-valgrind check to see if this actually resulted in regressions? My CPU is notoriously bad at benchmarking.

@TimWolla TimWolla requested review from iluuu1994 and nielsdos July 1, 2025 13:24
@iluuu1994
Copy link
Member

iluuu1994 commented Jul 1, 2025

❯ b 50 --mode=cycles 'sapi/cli/php-old -n benchmark/repos/symfony-demo-2.2.3/public/index.php' 'sapi/cli/php-new -n benchmark/repos/symfony-demo-2.2.3/public/index.php'
Old:       1.694 G ± 991.360 k (0.059%) 
New:       1.696 G ± 1.041 M (0.061%)
Diff:      2.264 M (0.134%)
T-test:    5.679
P-value:   0.001

First test looks to be slower.

Edit: Second run approx. confirms.

❯ b 50 --mode=cycles 'sapi/cli/php-old -n benchmark/repos/symfony-demo-2.2.3/public/index.php' 'sapi/cli/php-new -n benchmark/repos/symfony-demo-2.2.3/public/index.php'
Old:       1.697 G ± 1.114 M (0.066%)   
New:       1.698 G ± 957.368 k (0.056%)
Diff:      1.337 M (0.079%)
T-test:    3.282
P-value:   0.008
@TimWolla
Copy link
Member Author

TimWolla commented Jul 1, 2025

image

@iluuu1994
Copy link
Member

Can relate

These functions do not modify the state of the program and depend on
thread-safe global variables only.
@TimWolla TimWolla force-pushed the zend-get-executed-scope branch from b26e8a6 to 2fb856e Compare July 2, 2025 07:01
@nielsdos
Copy link
Member

nielsdos commented Jul 2, 2025

Coming from your other PR, I see now why you submitted this.
I don't know why this worsens performance, but indeed the benchmark seems to indicate now a deviation higher than noise.
It could be many different reasons, from alignment of functions/loops to bad compiler spill/rematerialization decisions...

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