Skip to content

Conversation

dirkmueller
Copy link
Contributor

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

@dirkmueller dirkmueller force-pushed the master branch 5 times, most recently from c2b85db to f602f64 Compare December 22, 2019 19:55
@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)
@earlephilhower earlephilhower merged commit 6c2ab25 into esp8266:master Dec 24, 2019
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.

3 participants