Remove creation of subrow from ReportQueryResult for batchfetch performance #2326
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.
This is a follow up to #2303. After some additional testing I observed some performance degradation when using batchfetch in with a ReportQuery. The degraded performance occurred when the item being constructed did not have the first index in the row. In this case a subrow was created that contained only the fields after the item index. When a batchfetch policy was in use this also required performing the same action on all the rows returned by the query and setting them for the data results in the batch fetch policy for the item's mappings as they would be used in the ForeignReferenceMapping to extract the required keys.
This caused every subrow to have to be created for every item even if it has been previously done because the rows use identity based equality. After looking through the downstream uses of the subrow it is not clear why this trimming is necessary. For the downstream object building values are extracted using their corresponding field references rather than by index in the row.
For this reason I have removed the creation of the subrow altogether but am also curious what the original reason for the subrow was and if this may have other performance implications for downstream processing of the row.