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

Read-only files/tabs opened by "Go To Definition" are touched (last modified dates), causing massive recompilation with superficial sketch change #2586

Open
3 tasks done
liudr opened this issue Dec 2, 2024 · 0 comments
Labels
type: imperfection Perceived defect in any part of project

Comments

@liudr
Copy link

liudr commented Dec 2, 2024

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

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@liudr liudr added the type: imperfection Perceived defect in any part of project label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

1 participant