refactor(database): optimize groupGetType by caching it inside BaseBuilder loops#10340
Open
gr8man wants to merge 1 commit into
Open
refactor(database): optimize groupGetType by caching it inside BaseBuilder loops#10340gr8man wants to merge 1 commit into
gr8man wants to merge 1 commit into
Conversation
michalsn
reviewed
Jun 25, 2026
michalsn
left a comment
Member
There was a problem hiding this comment.
Points 1 and 2 make sense - not necessarily as a performance optimization, but as a code-quality improvement.
Please revert point 3, as it changes the existing RawSql behavior.
If PR claims a performance improvement, please provide a reproducible benchmark and results demonstrating it. Otherwise, please use the refactor prefix. Performance claims should be supported by evidence provided by the PR author.
f7a23f0 to
07d2e7c
Compare
07d2e7c to
521a3e1
Compare
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.
Description
Inside
BaseBuilder'swhereHaving()and_like()methods,$this->groupGetType($type)was being called repeatedly insideforeachloops.This pull request optimizes these methods by:
$prefixoutside the loops before iteration starts.$prefixto$typeat the end of the loop iteration to correctly mimic subsequent query builder conditions._like()forRawSqlvs array inputs into a single loop using structured associative arrays (avoiding PHPTypeErrorsince array keys cannot beRawSqlobject instances).Checklist: