Is python in the fast path? Why not rewrite in a performant language for a XXX% speedup?
Speedup from switch to +=
11–20 of 85 posts
Re: Speedup from switch to +=
#12I guess this is the beauty of making a model open source.
Re: Speedup from switch to +=
#13If they're seeing these kinds of gains from relatively minor changes to their Python code, I can't help but wonder how much faster the model would run in a compiled language or a language with a good JIT (way more optimization work's gone into the mainstream Javascript runtimes than CPython). I'd assumed that overall performance in Stable Diffusion was limited by the code running on the GPU, with Python performance b…
Re: Speedup from switch to +=
#14Many times I have had to decide if my Python code would be more legible or get free performance.
The thing I like about JavaScript is that I can _usually_ trust the JIT to make my code faster than I could, meaning I can focus entirely on writing clean code.
P.S. you can always hand optimize. If you do, just comment the heck out of it.
Re: Speedup from switch to +=
#15I wonder what version of Python they were using? I'm wondering, because recent version have improved performance a lot. 3.11 is much faster than 3.10, and what's in 3.12 is already much faster than 3.11.
The upstream Stable Diffusion uses python 3.8: https://github.com/CompVis/stable-diffusion/blob/69ae4b35e0a...
Re: Speedup from switch to +=
#16Is python in the fast path? Why not rewrite in a performant language for a XXX% speedup?
Jokes aside this is pytorch so this is compiled to C++ or cuda, the problem likely comes from the different functions that are called for += vs +
Re: Speedup from switch to +=
#17Re: Speedup from switch to +=
#18If they're seeing these kinds of gains from relatively minor changes to their Python code, I can't help but wonder how much faster the model would run in a compiled language or a language with a good JIT (way more optimization work's gone into the mainstream Javascript runtimes than CPython). I'd assumed that overall performance in Stable Diffusion was limited by the code running on the GPU, with Python performance b…
Re: Speedup from switch to +=
#19If they're seeing these kinds of gains from relatively minor changes to their Python code, I can't help but wonder how much faster the model would run in a compiled language or a language with a good JIT (way more optimization work's gone into the mainstream Javascript runtimes than CPython). I'd assumed that overall performance in Stable Diffusion was limited by the code running on the GPU, with Python performance b…
Re: Speedup from switch to +=
#20If they're seeing these kinds of gains from relatively minor changes to their Python code, I can't help but wonder how much faster the model would run in a compiled language or a language with a good JIT (way more optimization work's gone into the mainstream Javascript runtimes than CPython). I'd assumed that overall performance in Stable Diffusion was limited by the code running on the GPU, with Python performance b…
The Python part only runs a handful of times so JIT vs. non-JIT doesn't really make a difference.