Skip to content

structs: share per-type struct field info - #7221

Draft
denik wants to merge 1 commit into
denik/structs-fsf-declaringfrom
denik/structs-field-info
Draft

denik wants to merge 1 commit into
denik/structs-fsf-declaringfrom
denik/structs-field-info

Conversation

@denik

@denik denik commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

structdiff and structwalk re-parsed struct tags on every visited field, and each package kept its own copy of the field rules (flattened embeds, json:"-", EmbeddedSlice, ForceSendFields). The copies already drifted twice (#7207, #7224). structaccess.GetStructInfo now computes these once per type, and structdiff, structwalk and structaccess use it. No behavior change.

JobSettings fixtures (go test -bench . -benchmem ./libs/structs/structdiff), median of 8, allocations unchanged:

before after
GetStructDiff, equal 56.3µs 16.6µs
GetStructDiff, changes 58.6µs 17.6µs
IsEqual, equal 46.0µs 9.7µs

libs/dyn/convert keeps its own struct info: it also tracks dyn.Value fields and walks embedded structs breadth-first.

Stacked on #7224. Previous: #7205

This pull request and its description were written by Isaac.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: bb50766

Run: 40706433312

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 281 15 5:39
✅​ aws-windows-latest-4core-16gb 283 13 5:51
✅​ azure linux-2core-8gb 280 15 5:20
✅​ azure-windows-latest-4core-16gb 282 13 6:42
✅​ gcp linux-2core-8gb 281 15 5:28
✅​ gcp-windows-latest-4core-16gb 283 13 5:28
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:55 gcp-windows-latest-4core-16gb TestAccept
4:51 azure-windows-latest-4core-16gb TestAccept
3:47 gcp linux-2core-8gb TestAccept
3:44 aws linux-2core-8gb TestAccept
3:41 azure linux-2core-8gb TestAccept
3:30 aws-windows-latest-4core-16gb TestAccept

structdiff and structwalk re-parsed struct tags for every visited field, and
each package kept its own copy of the field rules (flattened embeds,
json:"-", EmbeddedSlice, ForceSendFields). structaccess.GetStructInfo now
computes them once per type for structdiff, structwalk and structaccess.

No behavior change.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik force-pushed the denik/structs-field-info branch from 152acef to bb50766 Compare October 28, 2026 14:28
@denik
denik changed the base branch from main to denik/structs-fsf-declaring October 28, 2026 14:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants