Here's a rundown on before/after this change:
If the Haystack is a strand, use MVM_string_gi_cached_get_grapheme since it retains its grapheme iterator over invocations unlike MVM_string_get_grapheme_at_nocheck and caches the previous grapheme. It is slower for flat Haystacks though (ever since I got MVM_string_get_grapheme_at_nocheck to be inlined).
Also malloc the memory instead of putting it onto the stack if it is going to be more than 4069 bytes. Not 100% sure this is needed, but don't want to allocate too much to the stack since some platforms may have smaller stack size than current versions of Linux, Windows or MacOS do.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments.