Add PHP code optimization guide with opcache performance improvements #249
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.
This PR adds documentation about code-level optimizations for PHP applications, with a focus on opcache performance improvements using fully qualified function names with leading backslashes.
What was added
Added a new "Optimizing your code" section to the performance tuning guide that covers code-level optimizations separate from PHP environment configuration. The section explains:
count(),array_merge()), PHP first searches in the current namespace before falling back to the global namespace\count()instead ofcount()) tells PHP to directly use the global function, avoiding the namespace lookupnative_function_invocationrule rather than manual implementationExample
This follows the preference expressed in the issue comments that such optimizations should be automated rather than manually maintained. The documentation properly separates environment-level PHP optimizations from code-level optimizations, maintaining consistency with the existing guide structure and formatting.
Fixes #51
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.