Skip to content

reduce per-call overhead in RegisterFunc and callback dispatches #399

@tmc

Description

@tmc

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • Android
  • iOS

What feature would you like to be added?

A reduction in overhad for purego calls

Why is this needed?

RegisterFunc/CFunc/15args costs ~1845 ns with 44 allocs. Profiling shows the hot spots are repeated reflect.StructOf in Darwin ARM64 stack bundling (rebuilds struct type every call), heap-allocated []reflect.Value in callbackWrap (38.5% of total allocs), deferred cleanup closures, and per-call reflect.Kind dispatch. All of this is internal — no API changes needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions