arduino / arduino/Arduino

[IDE] Slow Startup - Create Examples menus for Libraries (need ignore files)

Open
#10,235 21 comments 0 reactions 0 assignees View on GitHub
Component: IDE feature request
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.