Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
cb4b8223
Commit
cb4b8223
authored
May 13, 2023
by
comfyanonymous
Browse files
Print custom nodes that take too much time to import.
parent
153f7ee1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
nodes.py
nodes.py
+11
-0
No files found.
nodes.py
View file @
cb4b8223
...
@@ -6,6 +6,7 @@ import json
...
@@ -6,6 +6,7 @@ import json
import
hashlib
import
hashlib
import
traceback
import
traceback
import
math
import
math
import
time
from
PIL
import
Image
from
PIL
import
Image
from
PIL.PngImagePlugin
import
PngInfo
from
PIL.PngImagePlugin
import
PngInfo
...
@@ -1325,6 +1326,7 @@ def load_custom_node(module_path):
...
@@ -1325,6 +1326,7 @@ def load_custom_node(module_path):
def
load_custom_nodes
():
def
load_custom_nodes
():
node_paths
=
folder_paths
.
get_folder_paths
(
"custom_nodes"
)
node_paths
=
folder_paths
.
get_folder_paths
(
"custom_nodes"
)
node_import_times
=
[]
for
custom_node_path
in
node_paths
:
for
custom_node_path
in
node_paths
:
possible_modules
=
os
.
listdir
(
custom_node_path
)
possible_modules
=
os
.
listdir
(
custom_node_path
)
if
"__pycache__"
in
possible_modules
:
if
"__pycache__"
in
possible_modules
:
...
@@ -1333,7 +1335,16 @@ def load_custom_nodes():
...
@@ -1333,7 +1335,16 @@ def load_custom_nodes():
for
possible_module
in
possible_modules
:
for
possible_module
in
possible_modules
:
module_path
=
os
.
path
.
join
(
custom_node_path
,
possible_module
)
module_path
=
os
.
path
.
join
(
custom_node_path
,
possible_module
)
if
os
.
path
.
isfile
(
module_path
)
and
os
.
path
.
splitext
(
module_path
)[
1
]
!=
".py"
:
continue
if
os
.
path
.
isfile
(
module_path
)
and
os
.
path
.
splitext
(
module_path
)[
1
]
!=
".py"
:
continue
time_before
=
time
.
time
()
load_custom_node
(
module_path
)
load_custom_node
(
module_path
)
node_import_times
.
append
((
time
.
time
()
-
time_before
,
module_path
))
slow_nodes
=
list
(
filter
(
lambda
a
:
a
[
0
]
>
1.0
,
node_import_times
))
if
len
(
slow_nodes
)
>
0
:
print
(
"
\n
Detected some custom nodes that were slow to import, if this is one of yours please improve it if you can:"
)
for
n
in
sorted
(
slow_nodes
):
print
(
"{:6.1f} seconds to import:"
.
format
(
n
[
0
]),
n
[
1
])
print
()
def
init_custom_nodes
():
def
init_custom_nodes
():
load_custom_nodes
()
load_custom_nodes
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment