Commit a5bbd10
Optimize splitMixCase buffer allocation
- Implemented heuristic pre-allocation (len(input) + len(input)/2) for splitMixCase to reduce reallocations during string building.
- Added optimization to return input directly if delimiter is empty, avoiding unnecessary processing.
- Added BenchmarkSplitMixCase to verify performance improvements.
Measured improvement: ~10% speedup, ~22% memory reduction, ~30% allocation reduction.
Co-authored-by: arran4 <111667+arran4@users.noreply.github.com>1 parent d6c51f4 commit a5bbd10
2 files changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
357 | 360 | | |
358 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
359 | 364 | | |
360 | 365 | | |
361 | 366 | | |
| |||
0 commit comments