Skip to content

Micro-optimisation: Change from spl_object_hash() to _id() - #6926

Merged
brusch merged 1 commit into
pimcore:masterfrom
NiklasBr:spl
Aug 24, 2020
Merged

Micro-optimisation: Change from spl_object_hash() to _id()#6926
brusch merged 1 commit into
pimcore:masterfrom
NiklasBr:spl

Conversation

@NiklasBr

Copy link
Copy Markdown
Contributor

Changes in this pull request

Resolves no specific issue. However, I am currently having trouble with performance with the Navigation system. While hunting down the reason for my problems I found some quick micro-optimisations which could be done.

Moving from spl_object_hash() to spl_object_id() should be faster by skipping XOR:ing and using integers rather than strings (polyfill exists). I could see some memory gains (250kB/request with a large menu).

Using the root namespace (e.g. symfony/symfony#21020) for the spl function saved two steps of stack trace for each call when Opcache was active, performance improvements was a few hundreds of a second for the request, so it did not do much. But it all adds up. :)

@brusch brusch added this to the 6.8.0 ("Summer Ale") milestone Aug 14, 2020
@brusch

brusch commented Aug 24, 2020

Copy link
Copy Markdown
Member

Thank you! 👌

@brusch
brusch merged commit f97b7f7 into pimcore:master Aug 24, 2020
@NiklasBr
NiklasBr deleted the spl branch August 24, 2020 11:29
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.

2 participants