2 ms·
Ah, good point. In my case, after benchmarking inside my actual app on real data, all three perform equally well (including the String.split version). Dropping
by lolinder 3y ago
Ah, good point.
In my case, after benchmarking inside my actual app on real data, all three perform equally well (including the String.split version). Dropping the Regex made the difference between this being the heavy part of the process to it being a rounding error, and there isn't much additional value to be gained. With that in mind, I'd rather go for legibility over speed.
I'm going to go with the for loop, though, because the extra memory usage could come back to bite me later.