Code size optimisations for ESP.getFullVersion() by dirkmueller · Pull Request #6936 · esp8266/Arduino

@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.