Skip to content

unique: string arguments do not need to escape #73680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mknyszek opened this issue May 12, 2025 · 2 comments
Open

unique: string arguments do not need to escape #73680

mknyszek opened this issue May 12, 2025 · 2 comments
Labels
Implementation Issues describing a semantics-preserving change to the Go implementation. NeedsFix The path to resolution is known, but the work has not been done. Performance
Milestone

Comments

@mknyszek
Copy link
Contributor

mknyszek commented May 12, 2025

unique clones any strings it finds in its input, if it can find them statically. (strings hidden somewhere in an interface value are excepted.) This means string arguments (or types whose only reference types are strings) never need to escape.

Note that pointer arguments still need to escape, because stack objects have no stable identity. But string arguments' identity is their data.

@mknyszek mknyszek added Performance NeedsFix The path to resolution is known, but the work has not been done. labels May 12, 2025
@mknyszek mknyszek added this to the Backlog milestone May 12, 2025
@jakebailey
Copy link
Contributor

Funnily this is effectively what I was fixing in CL 671955, mistakenly thinking I was fixing #71926.

@gabyhelp gabyhelp added the Implementation Issues describing a semantics-preserving change to the Go implementation. label May 12, 2025
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/671955 mentions this issue: cmd/compile: do not escape strings passed to unique.Make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation Issues describing a semantics-preserving change to the Go implementation. NeedsFix The path to resolution is known, but the work has not been done. Performance
Projects
None yet
Development

No branches or pull requests

4 participants