avalon60/ctk_theme_builder

ungodly slow

Closed this issue · 8 comments

exactly what the title says (how the hell do you deal with the 15 seconds that it takes to preview 1 theme)

os: debian bookworm
version: py 3.11

What hardware are you running on?
What version of CTk Theme Builder?
Are you saying that from selecting a theme it takes 15 seconds for the preview panel to open and load the theme?

What hardware are you running on? What version of CTk Theme Builder? Are you saying that from selecting a theme it takes 15 seconds for the preview panel to open and load the theme?

  1. hardware:

Host: Dell Latitude E6540
OS: Debian GNU/Linux 12 (bookworm) x86_64
Linux Kernel: 6.1.0-18-amd64
CPU: Intel i7-4610M (4) @ 3.700GHz
GPU: Integrated Graphics
RAM: 15898MiB (roughly 16GB)

  1. ctk theme builder version: 3.0.2
  2. it takes roughly 15 seconds to render the theme assuming the preview window is already open and im switching between themes

I suspect that there is a bottleneck on your system. I have 4 machines which I test on, and none of them exhibit that kind of delay. The worst performance I get is on an old Apple iMac Mini (2.3GHz i5 | 240GB SSD + 1TB HD | 16GB), which is generally quite sluggish with most things. I bought it off eBay, just for testing the app. That takes ~3-4 seconds.

I have an old Intel Core i3-4330 machine (midi Tower): ~2-3 seconds

AMD Ryzen 5 3400G (midi tower): ~2 seconds

Dell Latitude 7430 (laptop), Intel i71270P, 2200 Mhz: ~2 seconds.

Your CPU seems quite old (similar age to my i3-4330), and probably isn't as good at single threading as mine, and so that may be a factor?

Your CPU seems quite old (similar age to my i3-4330), and probably isn't as good at single threading as mine, and so that may be a factor?

i look at htop every single time and while it is rendering none of my resources get pegged, could be either igpu, python being slow, or unoptimized

Dunno, but CustomTkinter is slower than Tkinter, so that may be part of the problem.

also the app seems to be in a deadlocked-like state when i try to close it (have to do pkill -9 python)

and looking at htop, python seems to only be using 1 core and not multiple
https://github.com/avalon60/ctk_theme_builder/assets/86028086/735bd0a6-fce6-4399-9330-c52d30f1c6e6

Python doesn't really do proper multi-threading. It has a threading library, but only one thread can actually be running (on cpu) at any given time, due to the Global Interpreter Lock. The preview panel is launched as a separate Python program, and so I would expect that that might be able to take advantage of a different core, but your CPU has shorter legs than the i3-4330, and whereas it might be better at multi-threading, it kind of gets snookered.

Tkinter (and therefore CustomTkinter) isn't thread-safe either, so there is limited scope for leveraging threading.

Closing as answered.