Micro-optimize Splitter.split_on_string

In particular, memoize String#num_bytes and use a marginally more
efficient loop to trim null matches at the end.