It's good to avoid the polymorphic compare as it is unnecessarily expensive. I don't know what the performance for strings looks like but the previous char-by-char loop was appropriate, afaik.