What does HackerNews think of valhalla?

https://openjdk.org/projects/valhalla

Language: Java

Optional is being being converted to a value class as part of Project Valhalla. I reran the benchmarks with the latest Valhalla branch [1] and added a test that used OptionalLong instead of Optional.

Without Valhalla

- OptionBenchmark.sumSimple avgt 5 328,110 us/op

- OptionBenchmark.sumNulls avgt 5 570,800 us/op

- OptionBenchmark.sumOptional avgt 5 2223,887 us/op

- OptionBenchmark.sumOptionalLong avgt 5 1201,987 us/op

With Valhalla

- OptionBenchmark.sumSimpleValhalla avgt 5 327,927 us/op

- OptionBenchmark.sumNullsValhalla avgt 5 584,967 us/op

- OptionBenchmark.sumOptionalValhalla avgt 5 572,833 us/op

- OptionBenchmark.sumOptionalLongValhalla avgt 5 326,949 us/op

OptionalLong is now as fast as simple sum. And SumOptional is now as fast as SumNulls. So the overhead of using OptionalLong and Optional seems to have gone away with Valhalla.

It would be great if boxing could be eliminated as well. But few people writes code like what is being benchmarked (in hot loops) in practice.

[1] https://github.com/openjdk/valhalla

> Project Valhalla is trying to add proper value types to the JVM, but sadly as of today the project seems a bit abandoned...

The repo seems to have very recent activity, has commits from today! https://github.com/openjdk/valhalla