Read-only files/tabs opened by "Go To Definition" are touched (last modified dates), causing massive recompilation with superficial sketch change #2586
Labels
type: imperfection
Perceived defect in any part of project
Describe the problem
The tabs that open when using "Go To Definition" context menu when selecting a variable etc. will open a library file in the read-only mode, but, whenever the main sketch is saved, all of the read-only tabs have their file last modified time stamps changed to the main sketch save time. This causes ALL previously compiled library files to be recompiled even said library file has not materially changed. Take ESP32 for arduino core for instance, this causes a 60 second re-compilation of a particular library IRremoteESP8266 every time even a superficial change on the main sketch is made.
To reproduce
Open an example of IRremoteESP8266 library (or any example for another contributed library), compile the code with verbose compilation switch on to observe the time it takes to compile the contributed library, note the time to compile ESP32 core. Superficially change the example code such as adding an extra space character to one of the print statements and save it somewhere. Compile. Compile a second time to confirm that both the contributed library and ESP32 core are using cached compiled files and only the main sketch is compiled. Note the time of the whole compilation.
Now move editor cursor to one of the include directives and right click to "Go To Definition". Observe that the definition file (.h) is open in a read-only tab.
Open the definition file in a file browser and note its "Last Modified" time stamp. It's not your current time.
Make a superficial change to the example code again. Compile again to note the compile time of the contributed library and the ESP32 core. Contributed library gets recompiled, even though there wasn't any change to the library code.
Now go back to the file browser and note the library file's "Last Modified" time stamp has been updated to your current time.
Any subsequent superficial changes to the example code will cause all read-only tab files to get "Last Modified" time stamps updated thus recompilation of the library unnecessarily.
Now close all read-only tabs. Make another superficial change to the example code. Compile and note the time. The contributed library is no longer being recompiled and cached results are used.
Expected behavior
Read-only tabs/files will stay as is and don't get their "Last Modified" time stamps updated whenever the sketch is saved.
Arduino IDE version
2.3.3
Operating system
Windows
Operating system version
11
Additional context
Tested with 2.3.4.0 nightly build 20241202 and searched without finding this issue as reported.
See details of the discovery and discussion of this issue on the forum:
https://forum.arduino.cc/t/is-esp32-compiler-xtensa-esp32-elf-g-able-to-use-a-j-option-when-compiling/1325879
Issue checklist
The text was updated successfully, but these errors were encountered: