[performance] ngram index: method for computing string offsets

While working on a corpus of Sanskrit texts, we noticed that building an ngram index took minutes on the fastest machine, but several hours on other systems. Profiling showed the method for computing offsets by unicode code points being the main bottleneck. Replacing the code to avoid String.offsetByCodePoints improves indexing performance by at least factor 2, sometimes factor 10 or more.