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: Avoid using sameValueAs() when setting properties in ImmutablePropertyTrait #29

Merged
merged 1 commit into from
Dec 28, 2015
Merged

Performance: Avoid using sameValueAs() when setting properties in ImmutablePropertyTrait #29

merged 1 commit into from
Dec 28, 2015

Conversation

rbayliss
Copy link
Contributor

Changing the value of any property of a URL ends up triggering a call to ImmutablePropertyTrait::withProperty(). Inside this method, there's a call to UriPart::sameValueAs(), which ends up cascading a lot of calls down to other methods. What about just using a direct object comparison instead?

In this benchmark, this improves performance 10-20% (as measured by blackfire run --samples=5 php perf.php).

nyamsprod added a commit that referenced this pull request Dec 28, 2015
Performance: Avoid using sameValueAs() when setting properties in ImmutablePropertyTrait
@nyamsprod nyamsprod merged commit 7f24e16 into thephpleague:master Dec 28, 2015
nyamsprod added a commit that referenced this pull request Nov 17, 2022
Performance: Avoid using sameValueAs() when setting properties in ImmutablePropertyTrait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants