Skip to content
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

reflect: make struct field offset a varint #3686

Closed
aykevl opened this issue Apr 27, 2023 · 0 comments
Closed

reflect: make struct field offset a varint #3686

aykevl opened this issue Apr 27, 2023 · 0 comments
Assignees
Labels
reflection Needs further work on reflection
Milestone

Comments

@aykevl
Copy link
Member

aykevl commented Apr 27, 2023

#3656 added struct sizes and field offsets. This adds around 0.36% on average to the binary size according to my test, although the increase is highly variable (and sometimes negative).

I suspect most of the size increase comes from the struct field offsets. One way to reduce the overhead is by not storing the offset as a uint32, but rather as a variable width integer in the data byte array. I believe that will save 3 bytes per struct field in the common case.

@dgryski dgryski self-assigned this Apr 27, 2023
@dgryski dgryski added this to the v0.28.0 milestone Apr 27, 2023
@deadprogram deadprogram added the reflection Needs further work on reflection label Apr 27, 2023
dgryski added a commit to dgryski/tinygo that referenced this issue Apr 27, 2023
@deadprogram deadprogram added the next-release Will be part of next release label May 16, 2023
@aykevl aykevl closed this as completed in 07fb3a0 Jun 10, 2023
@deadprogram deadprogram removed the next-release Will be part of next release label Jun 11, 2023
LiuJiazheng pushed a commit to LiuJiazheng/tinygo that referenced this issue Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reflection Needs further work on reflection
Projects
None yet
Development

No branches or pull requests

3 participants