Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Performance and pointer vs non-pointer receivers #7

Open
petar opened this issue Feb 16, 2022 · 0 comments
Open

Performance and pointer vs non-pointer receivers #7

petar opened this issue Feb 16, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@petar
Copy link
Collaborator

petar commented Feb 16, 2022

Determine experimentally whether pointer or non-pointer receivers of generated types produce faster code.
Theoretically, it is unclear:

  • Non-pointer receivers afford a single allocation for entire recursive user types. But they incur a stack allocation when MapIterator is called (although it is possible that Go optimizes this away.)
  • Pointer receivers avoid the above problem, but then every level of a user type involves allocations.

For comparison, note that Protocol Buffers have opted for pointer receivers.

@petar petar added the enhancement New feature or request label Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant