inline string
Remi Forax
forax at univ-mlv.fr
Fri Dec 6 21:11:04 UTC 2019
----- Mail original -----
> De: "Kasper Nielsen" <kasperni at gmail.com>
> À: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Vendredi 6 Décembre 2019 21:55:34
> Objet: inline string
> Hi,
Hi Kasper,
>
> Are there any plans to add an InlineString type to the JDK?
>
> I can imagine that the first thing every single library out there will do with
> Valhalla is to implement their own inline string. It would be really nice to
> have a standardized version with good interop with JDK classes.
you mean [1] :)
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.
>
> /Kasper
Rémi
[1] https://github.com/forax/valuetype-lworld/blob/master/src/main/java/fr.umlv.valuetype/fr/umlv/valuetype/SmallString.java
More information about the valhalla-dev
mailing list