Repository navigation
Commit 7aac86c
committed
Small optimization of RLE decoding to avoid temporary lists.
list is a generic container with indirection for every element's type.
This makes it slower than a bytearray for basically any operation.
>>> timeit("a.extend(a[1:2] * 6024)", "a = bytearray(b'123' * 1024)", globals=globals())
7.540333299897611
>>> timeit("a.extend([a[1]] * 6024)", "a = bytearray(b'123' * 1024)", globals=globals())
35.9991508999373761 parent 6d9ddfd commit 7aac86c
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
0 commit comments