Conversation
…omparing whole values ReadResource, CreateResource, UpdateResource and ReadDataSource decided whether semantic equality had changed anything by deep-comparing the entire returned value against the value they passed in. For a resource with a large set attribute that comparison is O(n^2) in the number of set elements, and it runs on every one of those RPCs. SchemaSemanticEquality already knows whether it replaced a value, so have it report that in the response and drop the comparison. The four expectations updated here predate the new field; in each of them the proposed value is "new" and the expected new value is "prior", so the data did change and the comparison they replace reached the same conclusion.
samssh
force-pushed
the
semantic-equality-modified-flag
branch
from
September 3, 2026 07:13
2429e93 to
22d39d2
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.
Related Issue
Fixes #1322 (partially — this PR covers site 3)
Description
ReadResource,CreateResource,UpdateResourceandReadDataSourcedecidedwhether semantic equality had changed anything by deep-comparing the entire
returned value against the value they passed in:
For a resource with a large set attribute that comparison is O(n²) in the number
of set elements, and it runs on every one of those RPCs. In a CPU profile of a
real provider, a single call to this line accounted for 115s of a 181s profile.
SchemaSemanticEqualityalready knows whether it replaced a value — it is thecode doing the replacing — so it now reports that in the response and the four
call sites check the flag instead.
Four expectations in
schema_semantic_equality_test.gogainModified: true.Those literals predate the field; in each of them the proposed value is
"new"and the expected new value is
"prior", so the data genuinely changed and thecomparison being replaced reached the same conclusion. Nothing was weakened to
make a test pass.
Rollback Plan
Changes to Security Controls
No.