-
Notifications
You must be signed in to change notification settings - Fork 155
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
Reduce memory usage by changing const strings to string literals. #601
base: master
Are you sure you want to change the base?
Conversation
Started exploring this from curiosity of which approach is best. This SO page has some interesting discussion. |
interesting. I still don't like this approach, but clearly there is some benefit to it. I'll be interested in whether we see the same reductions when combined with a newer compiler |
Results with latest compiler below. Seems like the only advantage is size. Thought it would make the file look cleaner but it doesn't. Perhaps a typedef would be good for that. Don't mind to close this and just keep in mind if bytes get short again. With Names #defined as string literals (const_to_define) Names as char array (master at e33da01) |
Do u want to try with lto8.2 brach to see the result? |
lto8.2 + const_to_define Please consider an environment variable to disable lto when running make. It adds significantly to the build time so it will be good to have an option to build without it during development. |
not really a discussion for this thread, but that will be challenging for at least the 7e, since we'll likely take advantage of the extra space it provides... |
sorry, 7e LTO build is not done yet. I didn't get it working.... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is enough improvement in this method to implement it now. I'm open to understanding why the compiler isn't doing a good job with string arrays, but I am not ready to accept this at this time.
For the t8sg_v2_plus build:
Names #defined as string literals
ROM: 0x08003000 - 0x0803b2c4 = 224.69kB
RAM: 0x20000000 - 0x20008df8 = 35.49kB
Names as char array (master at e33da01)
ROM: 0x08003000 - 0x0803b34c = 224.82kB
RAM: 0x20000000 - 0x20008e00 = 35.50kB