reduce unnecessary re-indexing extra networks directory #14512
Merged
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.
Description
webui calles
extra networks refresh()
when the webpages loadsthe refresh function includes clearing out the existing extra networks list and crawling through the directories again
this is unnecessary
particularly in lots of cases on initial launch of the server followed by loading of web page from the browser when the list was just created seconds before
this possibly would help reduce the issue with #14507
assuming that the issue is caused by crawling through the large directory
more improvements can be done if we cache the extra networks list and HTML
and only updated them when there is change to the directories
it might be possible to improve the performance by making indexing and creating of html multi-threaded (for each network type)
moveing indexing on to a separate thread might also improved performance
stable-diffusion-webui/extensions-builtin/Lora/networks.py
Line 643 in 9c6ea53
Changes
split the
creating of the HTML
from therefreshing the list of extra networks
the refresh button still refreshes the list reindexing the directory
but the creating of the HTML triggered by the loading of web page only creates the HTML and not reloads the list
Checklist: