Skip to content

cmd/compile: optimize reflect.Value.Set with short-lived Values #57060

@dsnet

Description

@dsnet

Some accessor reflect.Value methods must allocate since they return value that references an underlying value that must be heap allocated.

Such patterns include:

v1.Set(v2.MapIndex(...))
v1.Set(v2.Slice(...))
v1.Set(v2.Slice3(...))

In such a usage, the generated value could be stack allocated since it only used as an intermediate storage before the value is stored into v1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions