Speedup from switch to +=
github.com
Speedup from switch to +=
1–10 of 85 posts
Re: Speedup from switch to +=
#2Re: Speedup from switch to +=
#3Re: Speedup from switch to +=
#4I'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.
Re: Speedup from switch to +=
#5Re: Speedup from switch to +=
#6But why is it faster? A non-associative translation to byte code (or however python works)?
Re: Speedup from switch to +=
#7I'd assumed that overall performance in Stable Diffusion was limited by the code running on the GPU, with Python performance being a fairly minor factor-- but I guess that's not the case?
Re: Speedup from switch to +=
#8But why is it faster? A non-associative translation to byte code (or however python works)?
>>> def f(x): x += 1
...
>>> def g(x): x = x + 1
...
>>> dis.dis(f)
1 0 LOAD_FAST 0 (x)
3 LOAD_CONST 1 (1)
6 INPLACE_ADD
7 STORE_FAST 0 (x)
10 LOAD_CONST 0 (None)
13 RETURN_VALUE
>>> dis.dis(g)
1 0 LOAD_FAST 0 (x)
3 LOAD_CONST 1 (1)
6 BINARY_ADD
7 STORE_FAST 0 (x)
10 LOAD_CONST 0 (None)
13 RETURN_VALUERe: Speedup from switch to +=
#9But why is it faster? A non-associative translation to byte code (or however python works)?
Re: Speedup from switch to +=
#10I 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.
https://github.com/CompVis/stable-diffusion/blob/69ae4b35e0a...