Improve performance by using global namespace prefix for all functions#285
Merged
Improve performance by using global namespace prefix for all functions#285
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves performance by consistently using the global namespace prefix \ for all global PHP function calls throughout the codebase. This optimization was already partially in place, and now it's applied uniformly across all files.
- Adds global namespace prefix
\to all remaining global function calls - Maintains consistency with existing code that already used this optimization
- Applies changes across 9 files covering various components (SAPI handler, routing, middleware, logging, container, etc.)
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Io/SapiHandler.php | Added \ prefix to string manipulation, I/O, and PHP configuration functions |
| src/Io/RouteHandler.php | Added \ prefix to array functions and assertions |
| src/Io/MiddlewareHandler.php | Added \ prefix to assert and count functions |
| src/Io/LogStreamHandler.php | Added \ prefix to assert function |
| src/Io/FiberHandler.php | Added \ prefix to assert function |
| src/FilesystemHandler.php | Added \ prefix to assert function |
| src/Container.php | Added \ prefix to type checking, assertion, and class existence functions |
| src/App.php | Added \ prefix to assert function |
| src/AccessLogHandler.php | Added \ prefix to string, time, and encoding functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This changeset improves performance slightly in synthetic benchmarks by using the global namespace prefix
\for all global functions. This was already in place for most invocations, now it is used consistently throughout the entire code base.Refs reactphp/stream#137 and others