Commit a22e5ce
pystrhex: Add SIMD optimization for large separator groups
Extend the portable SIMD hexlify to handle separator cases where
bytes_per_sep >= 16. Uses in-place shuffle: SIMD hexlify to output
buffer, then work backwards to insert separators via memmove.
For 4096 bytes with sep=32: ~3.3µs (vs ~7.3µs for sep=1 scalar).
Useful for hex dump style output like bytes.hex('\n', 32).
Also adds benchmark for newline separator every 32 bytes.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent ae3d7be commit a22e5ce
2 files changed
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
187 | 231 | | |
188 | 232 | | |
189 | 233 | | |
| |||
221 | 265 | | |
222 | 266 | | |
223 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
224 | 272 | | |
225 | 273 | | |
226 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
82 | 97 | | |
83 | 98 | | |
84 | 99 | | |
| |||
179 | 194 | | |
180 | 195 | | |
181 | 196 | | |
| 197 | + | |
182 | 198 | | |
183 | 199 | | |
184 | 200 | | |
| |||
0 commit comments