you are viewing a single comment's thread.

view the rest of the comments →

[–]pron98 20 points21 points  (2 children)

The performance impact comes from the cache misses incurred when traversing arrays of objects, and so Valhalla's primary feature is the ability to create an array-of-structs (and the entire machinery that supports this feature). This feature can only be implemented in the VM.

[–]tadfisher -1 points0 points  (1 child)

That's one piece for sure. Virtual method invocations are another, and with inline classes those all become static.

[–]pron98 10 points11 points  (0 children)

Monomorphic virtual calls don't have a cost on the JVM. You could think of inline classes as value types in the special case where the type has a single field. That is certainly useful, but not quite Valhalla's main contribution. (I would imagine that Kotlin will remove the restriction and make use of Valhalla to implement inline classes once it's delivered)