Skip to content
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

Performance: Use preg_match to convert non-unicode characters to lowercase in hostname #27

Merged
merged 2 commits into from
Dec 28, 2015
Merged

Conversation

rbayliss
Copy link
Contributor

HostnameTrait::lower() is pretty slow, because it's currently doing a lot of work to lowercase only ASCII characters. Running this script through Blackfire locally, I get a 9% speed boost (2.51s vs 2.29s when run using blackfire run --samples=5 php perf.php) after applying the following change. I don't see any downsides, and it still passes all tests.

nyamsprod added a commit that referenced this pull request Dec 28, 2015
Performance: Use preg_match to convert non-unicode characters to lowercase in hostname
@nyamsprod nyamsprod merged commit 90677c9 into thephpleague:master Dec 28, 2015
@rbayliss rbayliss deleted the hostname_lower_perf branch December 28, 2015 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants