Repository navigation
Performance: Inline the object type check in change set computation - #12791
Conversation
b18b590 to
ea275a8
Compare
|
Note Greptile reviews are for Doctrine maintainers as a first filter, do not start fixing all the issues immediately unless you think they make sense. A maintainer will give you a green light on this PR for further development or rejection.
[Low impact] The PR appears safe to merge.
|
mpdude
left a comment
There was a problem hiding this comment.
I know almost nothing about those engine internals, so I would not have spotted the optimization potential or need myself… From my userland-only perspective, a comment at the call sites or method header would be helpful, pointing out why it’s designed that way
#12753 calls
isSameConvertedDatabaseValue()for every mapped field whose value differs. Theis_object()guards make the method cheap, but the call itself is not: method lookup, call frame and argument passing are paid on the hottest path of theUnitOfWork.The check is now inlined at both call sites.
is_object()compiles to a singleZEND_TYPE_CHECKopcode (Z_TYPE_P(value) != IS_OBJECT), so the&&chain short-circuits for scalar values without any call. The method takesobjectparameters, and the field mapping check stays inside for the to-one associations walked byrecomputeSingleEntityChangeSet().