Fix exponential perf degradation in Time.parse and Time.strptime.

Closes #1319.
Merge pull request #1573 from int3/jruby-1_7

Fix exponential perf degradation in Time.parse and Time.strptime.