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

Code size optimisations for ESP.getFullVersion() #6936

Merged
merged 1 commit into from
Dec 24, 2019

Conversation

dirkmueller
Copy link
Contributor

This saves about ~ 60 bytes of flash usage (50% reduction of
the total function size)

@earlephilhower
Copy link
Collaborator

@dirkmueller, neat work, but it might end up with more fragmentation due to the multiple +=s.

A .reserve() of some sufficiently long number (probably empirically determined) would ensure no memory allocation for the string concat'ing.

Another idea, since you seem to be on a PMEM optimization kick :), most of this string concatenation can be replaced with a single constant string, so some multi-line #define may be able to make many of the String +=s unnecessary (i.e. no need to += when you're just adding two compile-time strings.

@dirkmueller
Copy link
Contributor Author

@earlephilhower its not worse than temporary strings (for the concatenation using +) created before, but you're right, I forgot to add a reserve() statement. fixed now.

This saves about ~ 60 bytes of flash usage (50% reduction of
the total function size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants