I had no luck getting offset and count to work with JDK 1.6. I disable FastStringUtils if JDK 1.6 is encountered, i.e., if I find a Count and Offset, I turn off FastStrngUtils. This works, and we get the speed for JDK 1.7.

I noticed you use Unsafe. From what I can tell it is almost optional,
but not 100%. There is a chance to find a slightly different
implementation of String out there.

When you do
https://github.com/groovy/groovy-core/pull/317/files#diff-d5083c2146fab6
0490dfd6f620890fdfR61 I assume your thought is that either all or none
of the fields there are available. Effectively if the field count is
not available, your test for direct access still passes and then line
93 would fail.

To avoid checking against multiple things all the time I would suggest
to add a boolean for this... or you reuse ENABLED for this - then you
need to set the value later.

what do you think? Jochen Theodorou