Skip to content

Optimize eager loads map key generation - #1475

Merged
stephenafamo merged 4 commits into
aarondl:masterfrom
nicowolf91:optimize-eager-loads
Jun 18, 2026
Merged

Optimize eager loads map key generation#1475
stephenafamo merged 4 commits into
aarondl:masterfrom
nicowolf91:optimize-eager-loads

Conversation

@nicowolf91

Copy link
Copy Markdown
Contributor

Following up on #1473, I improved the map key generation logic.

Primitive values, strings and byte slices in particular, no longer go through fmt.Sprintf, which reduces overhead. Numeric values are now handled by the strconv package, which is faster and produces fewer allocations.

SQL driver.Valuer types are unwrapped directly inside generateMapKey, which keeps the generated eager-loading code more readable and concise.

generateMapKey handles the typical data types used as database keys efficiently, with a best-effort fmt.Sprintf fallback for unrecognized types.

Let me know, if anything is missing!

@stephenafamo
stephenafamo merged commit 76177ef into aarondl:master Jun 18, 2026
2 checks passed
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