inline string

Kasper Nielsen kasperni at
Mon Dec 9 12:19:52 UTC 2019

Hi Remi,
> I think it's fine as an exercise (my implementation is how to use unsafe with inlined fields) but i disagree that the JDK should have such class because one implementation of String is far better than two (or three, four like you have in any decent C++ application) whatever the performance you get (and having performance when you re-implement String without the intrinsics is not easy).
> Maybe in the future, with Array 2.0 (an array that behave like an inline) and the panama vector API, String implementation may be changed but introducing another kind of String seems a bad idea.

This makes sense to me. As I understand it fused arrays will never
work with inline types because the size of an inline type needs to be
constant. So you end up with either an inline type and a referenced
array. Or a reference type and a fused array. Either way, you need to
allocate something on the heap.


More information about the valhalla-dev mailing list