Fix perf bug.
Fix perf bug.

This fixes a performance bug where clearing previously allocated space
for the backtracking engine does too much work. It can happen when the
allocation grows big for a long input string. On subsequent searches,
even if the input is smaller, clearing the allocation was still clearing
it for the space required for the longer input. We avoid that in this
commit by truncating the space first.

golddranks/regex,SeanRBurton/regex,rust-lang/regex,rust-lang-nursery/regex,rust-lang-nursery/regex,SeanRBurton/regex,rust-lang/regex,rust-lang/regex,rust-lang-nursery/regex,rust-lang-nursery/regex,rust-lang/regex,SeanRBurton/regex,rust-lang-nursery/regex,SeanRBurton/regex,golddranks/regex,rust-lang/regex,golddranks/regex,SeanRBurton/regex