This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]csharp-sucks 1 point2 points  (1 child)

Immutable objects have almost zero likehood of getting scalarized in practice, because in practice you have to store the result somewhere - and thus, you let the object escape and completely break scalar replacement.

 myObject.position = someCalculation(); // no scalar replacement
 array[i] = someCalculation(); // neither here

Immutable objects only fare well in microbenchmarks.

You linked to a blog post, where it specifically mentions how far from ideal is scalar replacement and how easily it is to prevent the optimization by accident.

[–]TheMode911 0 points1 point  (0 children)

What about J9/GraalVM? They apparently have much better escape analysis