4 ms·
Nice post, I have a question on one piece of it though. In your final version of splitSpaces() you are calculating the length of b - 1 in the condition of the
by rartichoke 14y ago
Nice post, I have a question on one piece of it though.
In your final version of splitSpaces() you are calculating the length of b - 1 in the condition of the for loop.
Is Go calculating len(b) - 1 in every iteration or is it smart enough to move it out of the condition at compile time?
- mseepgood 14y agoGo slices (and strings) know their length: http://research.swtch.com/godata http://research.swtch.com/godata So it's not a computation, just a struct member access. And len() is a builtin, not a real function call.