8000 Use `spl_object_id()` instead of `spl_object_hash()` by rosier · Pull Request #59355 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Use spl_object_id() instead of spl_object_hash() #59355

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

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

rosier
Copy link
Contributor
@rosier rosier commented Jan 3, 2025
Q A
Branch? 7.3
Bug fix? no
New feature? no
Deprecations? no
Issues -
License MIT

Small performance tweak.

@xabbuh
Copy link
Member
xabbuh commented Jan 3, 2025

Do you have a benchmark which proves that using spl_object_id() is indeed more efficient?

@rosier
Copy link
Contributor Author
rosier commented Jan 3, 2025

@OskarStark OskarStark changed the title Use spl_object_id() instead of spl_object_hash() [Performance] Use spl_object_id() instead of spl_object_hash() Jan 3, 2025
@carsonbot carsonbot changed the title [Performance] Use spl_object_id() instead of spl_object_hash() Use spl_object_id() instead of spl_object_hash() Jan 3, 2025
@jderusse
Copy link
Member
jderusse commented Jan 3, 2025

spl_object_id() reuse identifiers. This is not safe and should be use carefully

@antonkomarev
Copy link

@jderusse as it stated in official documentation it's working exactly same as hash

javiereguiluz added a commit to EasyCorp/EasyAdminBundle that referenced this pull request Jan 4, 2025
…uiluz)

This PR was merged into the 4.x branch.

Discussion
----------

Minor performance improvement in Twig extension

`spl_object_id()` is slightly faster than `spl_object_hash()` (see symfony/symfony#59355) and `xxhash` algorithms are much faster than `md5`

Commits
-------

f595045 Minor performance improvement in Twig extension
@nicolas-grekas
Copy link
Member

Thank you @rosier.

8000 @nicolas-grekas nicolas-grekas merged commit 31df2cf into symfony:7.3 Jan 6, 2025
10 of 11 checks passed
nicolas-grekas added a commit that referenced this pull request Jan 6, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

[Lock] Use a WeakMap as store registry

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

As suggested here #59355 (comment)

Commits
-------

ba1c9e3 Use a WeakMap as store registry
symfony-splitter pushed a commit to symfony/lock that referenced this pull request Jan 6, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

[Lock] Use a WeakMap as store registry

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

As suggested here symfony/symfony#59355 (comment)

Commits
-------

ba1c9e3ae08 Use a WeakMap as store registry
@rosier rosier deleted the spl-object-id branch January 6, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0