Open ricardojlrufino opened 4 years ago
What I notice in the IDE is that there are a series of problems to keep the menus filled and always consistent, I think it would be better to have a BoardSettingsDialog, to configure the board.
I did something similar with the examples, which had this problem, and were very slow to load.
See Time lost for loading board Esp8266 On startup the method filterVisibilityOfSubsequentBoardMenus, (sum the time of all the submenus)
##### Upload Speed - time: 1612ms -- thread:pool-1-thread-1
##### CPU Frequency - time: 1757ms -- thread:pool-1-thread-1
##### Crystal Frequency - time: 2012ms -- thread:pool-1-thread-1
##### Flash Size - time: 1551ms -- thread:pool-1-thread-1
##### Flash Mode - time: 1571ms -- thread:pool-1-thread-1
##### Flash Frequency - time: 961ms -- thread:pool-1-thread-1
##### Reset Method - time: 1002ms -- thread:pool-1-thread-1
##### Debug port - time: 654ms -- thread:pool-1-thread-1
##### Debug Level - time: 1022ms -- thread:pool-1-thread-1
##### lwIP Variant - time: 850ms -- thread:pool-1-thread-1
##### Builtin Led - time: 895ms -- thread:pool-1-thread-1
##### Erase Flash - time: 1051ms -- thread:pool-1-thread-1
That's because it selects all the submenus, and forces a scan of the libraries.
I managed to correct these errors, so I will do a PR to be able to better evaluate
TBH, the board selection code, especially wrt to option menus, is a bit of a mess that could use a big refactor and cleanup. However, I suspect that in the near feature, some of this code might end up being moved into arduino-cli
, once the java IDE starts to use that (then maybe the resolution of all available board options might be done in arduino-cli
, with the IDE just showing whatever menus arduino-cli
returns for the selected board). I'm not sure if this is the plan, maybe @cmaglie can comment.
Anyway, I think fixing this slow startup would be good to do already (better to not wait for arduino-cli
with that, just maybe try it without too much a refactor).
Thanks for looking into this, I'm looking forward to a PR :-)
I am doing some analysis to improve the IDE startup time (I am discussing the topic in the email list).
I found another problem that is related to the menus. In particular:
createBoardMenusAndCustomMenus
, and in the method:filterVisibilityOfSubsequentBoardMenus
.What happens is that for each menu on a board such as Esp8266, it is calling
LibrariesIndexer.rescanLibraries()
, and it ends up costing a lot of time at startup and also when selecting a board.This is the stack (not an error ...):
As you can see for each menu item, he is manually calling 'actionPerformed', and doing a lot of unnecessary things