Commit 169c79a
committed
perf(path): PathBase + PathExt zero-alloc via lastIndex
Replace Split([]string) + last-element index with lastIndex + string-slice.
PathExt inherits the win because it calls PathBase.
PathBase 56.9 ns / 1 alloc → 33.1 ns / 0 allocs 1.7x
PathExt 58.2 ns / 1 alloc → 34.5 ns / 0 allocs 1.7x1 parent d9522dc commit 169c79a
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
100 | 105 | | |
101 | 106 | | |
102 | 107 | | |
| |||
0 commit comments