who would have thought that str.charAt(str.length - 1) is not a constant, instant operation? seems to get slower and slower as the string grows. 0.6s vs. 3s