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

Optimalize structs for size (alignment by rearranging) #149

Open
tgulacsi opened this issue Nov 8, 2020 · 2 comments
Open

Optimalize structs for size (alignment by rearranging) #149

tgulacsi opened this issue Nov 8, 2020 · 2 comments

Comments

@tgulacsi
Copy link

tgulacsi commented Nov 8, 2020

go get -u github.com/orijtech/structslop/cmd/structslop
structslop github.com/godror/godror

reported a few structs that could be rearranged to become smaller.

I understand that *char and its length should be together, so maybe this rearrangement has too few gains and too big price for structs that are only have a few instances in a program, such as dpiConnCreateParams or dpiCommonCreateParams.

But may more gain more with dpiSubscrMessageTable and dpiSubscrMessage.

@tgulacsi
Copy link
Author

tgulacsi commented Nov 8, 2020

structslop.patch.txt

@anthony-tuininga
Copy link
Member

@tgulacsi, thanks for the suggestion. That's something that could only be considered for version 5 when structure changes like these are possible without breaking backwards compatibility. So I'll keep this in mind when version 5 is being prepped.

tgulacsi pushed a commit to godror/godror that referenced this issue Nov 19, 2021
Object creation and release fragments memory. This is not a real memory
leak (less than 3 bytes for 100 iteration with standard malloc, and less
than 1 byte for 100 iteration with jemalloc).

To try with jemalloc:

    LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 go test -run=198 -v

ODPI-C issue: oracle/odpi#149

Closes #198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants