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

String literal storage optimization #58

Open
ForNeVeR opened this issue Jan 11, 2022 · 1 comment
Open

String literal storage optimization #58

ForNeVeR opened this issue Jan 11, 2022 · 1 comment
Labels
area:cil-interop Related to CIL (.NET) interop good-first-issue An issue considered simple enough for new contributors hacktoberfest kind:feature New feature or request status:help-wanted Open for contributors

Comments

@ForNeVeR
Copy link
Owner

ForNeVeR commented Jan 11, 2022

When storing two literals, "bar" and "foobar", the compiler may optimize them to save space in the binary: only store "foobar" and point "bar" pointer to the middle of the literal.

 f o o b a r \0
 ↑     ↑
 |    "bar" points here
"foobar" points here
@ForNeVeR ForNeVeR added the kind:feature New feature or request label Jan 11, 2022
@ForNeVeR
Copy link
Owner Author

Thanks to @a1batross for this suggestion.

@ForNeVeR ForNeVeR added the area:cil-interop Related to CIL (.NET) interop label Jan 16, 2022
@ForNeVeR ForNeVeR added good-first-issue An issue considered simple enough for new contributors status:help-wanted Open for contributors labels Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:cil-interop Related to CIL (.NET) interop good-first-issue An issue considered simple enough for new contributors hacktoberfest kind:feature New feature or request status:help-wanted Open for contributors
Projects
None yet
Development

No branches or pull requests

1 participant