Improve performance of Ruby's palindrome test.