Move populateSketchbookMenu to a separate thread #1037
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were getting reports of Processing being slow to start, we diagnosed it to having a lot of folders within the sketchbook. The problem arises from Processing indexing all the folders recursively on the UI thread.
While this has been a known issue—documented in the troubleshooting guide—we noticed it's made significantly worse in cases where users have multiple Android SDKs installed inside their sketchbook; each SDK contains a large number of subfolders, making Processing hang for a long time on startup or when switching mode.
This PR moves the scanning to a separate thread. It also skips scanning the
android
folder if present in the sketchbook.These changes should help alleviate some of the slowdown but it’s only a quick fix. Long term, we probably need a better approach, avoiding recursion and maybe caching the results.
Fixes #1036
Related to #897?