Improve performance of CheckSystemEnvironment middleware#6604
Open
TimWolla wants to merge 2 commits intoWoltLab:6.2from
Open
Improve performance of CheckSystemEnvironment middleware#6604TimWolla wants to merge 2 commits intoWoltLab:6.2from
CheckSystemEnvironment middleware#6604TimWolla wants to merge 2 commits intoWoltLab:6.2from
Conversation
The version checking condition can be evaluated by OPcache at compile time,
eliding the entire middleware's logic (except for passing along the request to
the next middleware) in the common case of running a supported PHP version.
Particularly it avoids a useless call to `->isACPRequest()`.
Before:
wcf\http\middleware\CheckSystemEnvironment::process:
; (lines=11, args=2, vars=2, tmps=1)
; (after optimizer)
; wcfsetup/install/files/lib/http/middleware/CheckSystemEnvironment.class.php:27-43
0000 CV0($request) = RECV 1
0001 CV1($handler) = RECV 2
0002 INIT_STATIC_METHOD_CALL 0 string("wcf\\system\\request\\RequestHandler") string("getInstance")
0003 V2 = DO_FCALL
0004 INIT_METHOD_CALL 0 V2 string("isACPRequest")
0005 DO_FCALL
0006 INIT_METHOD_CALL 1 CV1($handler) string("handle")
0007 SEND_VAR_EX CV0($request) 1
0008 V2 = DO_FCALL
0009 VERIFY_RETURN_TYPE V2
0010 RETURN V2
LIVE RANGES:
2: 0009 - 0010 (tmp/var)
After:
wcf\http\middleware\CheckSystemEnvironment::process:
; (lines=7, args=2, vars=2, tmps=1)
; (after optimizer)
; wcfsetup/install/files/lib/http/middleware/CheckSystemEnvironment.class.php:27-43
0000 CV0($request) = RECV 1
0001 CV1($handler) = RECV 2
0002 INIT_METHOD_CALL 1 CV1($handler) string("handle")
0003 SEND_VAR_EX CV0($request) 1
0004 V2 = DO_FCALL
0005 VERIFY_RETURN_TYPE V2
0006 RETURN V2
LIVE RANGES:
2: 0005 - 0006 (tmp/var)
This allows OPcache to evaluate the condition at compile-time. While not particularly important in this case, it's good for consistency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See individual commits.