[IDE] Slow Startup - Create Examples menus for Libraries (need ignore files)
- Dominant language
- Java
- Stars
- 14.6k
- Forks
- 7k
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I realized that also the code that builds the examples of the libraries, may have a problem. If the library has large documentation (docs) like generated by doxygen, or some other directory with many files, the IDE will take a long time to scan.
My first idea was to ignore the known files ... as is done with .svn and .git ... but I ended up identifying that it is better to do this treatment below:
https://github.com/arduino/Arduino/blob/02a2e22649feb4d85d807b51122f2501b06da866/app/src/processing/app/Base.java#L1779-L1781
to this:
To only focus on the folder of interest.
```
private boolean addSketchesSubmenu(JMenu menu, UserLibrary lib) {
File examples = new File(lib.getInstalledFolder(), "examples");
JMenu submenu = new JMenu(lib.getName());
boolean found = addSketches(submenu, examples);
if (found) {
menu.add(submenu);
MenuScroller.setScrollerFor(submenu);
}
return found;
}
```
In my case I had a node_modules folder (don't ask me why ... lol) it took about 5s to read it
total time was around 11s, because i had another library with a big docs folder.
PS: Sorry for opening several separate problems, but it is for us to track the errors I found. As it is part of an ongoing refactoring, in order to solve part of the same "slow startup" problem, it is difficult to make several separate pull requests.
Contributor guide
Research direction
Read app/src/processing/app/Base.java around the linked addSketchesSubmenu code and trace how library examples are scanned. Reproduce startup with a library containing a large docs or node_modules directory; done means example-menu creation focuses on the examples folder and avoids scanning unrelated files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100