Page 1 of 1

Affect of non-live code on performance

Posted: Tue Dec 07, 2021 1:45 pm
by Electroguard
Do unused subroutines affect Annex, CiccioCB ?

Sometimes I 'evolve' eg: a periodic timer 'Ticker' subroutine to keep adding all the required flag-trapping behaviours, until it becomes too much of a tangled mess.
Then I rename it to something like tickerX for safe-keeping and start with a new clean Ticker, just neatly adding back in functionalities from tickerX to Ticker in a more orderly and integrated manner.

I could comment out all the old tickerX, but it would make it much harder to read and understand, especially as it would undoubtedly already contain non-live lines that had been previously commented out (eg: if trying out alternatives I often copy the original line(s) then edit the copies while leaving the originals commented out for quick restore if needed, and the same can apply to complete alternative subroutines).

It's been my understanding that Annex ignores comments and un-referenced subroutines, but I thought I should ask in case it might have an impact on performance.

Re: Affect of non-live code on performance

Posted: Tue Dec 07, 2021 2:48 pm
by cicciocb
Hi Robin,
all the comments are stripped out when the code is loaded in the internal memory.
The unused code is still copied in the memory but do not effects the performance.

Re: Affect of non-live code on performance

Posted: Tue Dec 07, 2021 3:14 pm
by Electroguard
Hmm, so it's possible for unused code to contribute to an 'out of memory' error.
But in event of an 'out of memory' error, any unused code could be converted to comment to ease the situation.
Thank you sir.

Re: Affect of non-live code on performance

Posted: Tue Dec 07, 2021 4:12 pm
by cicciocb
[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Dec 07, 2021 3:14 pm Hmm, so it's possible for unused code to contribute to an 'out of memory' error.
But in event of an 'out of memory' error, any unused code could be converted to comment to ease the situation.
Thank you sir.
This could be true for the ESP32 because the code is copied in the RAM but for not for the ESP8266.
However, starting from the latest releases, the code is copied in the external PSRAM that is 4MB .... (obviously this is true only for modules equipped)