From 6eae768fb06da8eb9dc8d0227ac1f7151b26d844 Mon Sep 17 00:00:00 2001 From: Midcoastal Date: Tue, 15 Aug 2023 23:08:26 -0400 Subject: [PATCH] Gather HTML parts as list to append in the end Somehow, significant increase in speed (size of text append was slowing large loads down. --- modules/ui_extra_networks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index 4e31f38f1..75d3a7e23 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -190,6 +190,7 @@ class ExtraNetworksPage: self.items = [] shared.log.error(f'Extra networks error listing items: {self.__class__}') self.create_xyz_grid() + htmls = [] with Progress( SpinnerColumn(), TextColumn('[cyan]Creating Extra Network '+self.title+' HTML - {task.description}'), @@ -199,16 +200,15 @@ class ExtraNetworksPage: task = progress.add_task(description=f'Initializing Items') items = self.items progress.update(task, total=len(items)) - __t = None + __t = time() __i = 0 for item in items: - if __t is None: - __t = time() __i += 1 self.metadata[item["name"]] = item.get("metadata", {}) self.info[item["name"]] = self.find_info(item['filename']) - self.html += self.create_html_for_item(item, tabname) + htmls.append(self.create_html_for_item(item, tabname)) progress.update(task, advance=1, description=f"{round(__i/(shared.time.time()-__t))} item/s") + self.html += ''.join(htmls) if len(subdirs_html) > 0 or len(self.html) > 0: res = f"
{subdirs_html}
{self.html}
" else: