Improve running time by about 15% by using strings & precomputed length.

Strings are about 3-4% faster in my testing vs arrays. Surprisingly,
UIDCHARS.length is actually slightly faster than precomputing the length
outside the function - I assume reaching up the stack causes it.