I heavily use NullValues and I believe this pull request will help improving the overall performance of NullValue creation inside Value.java, as the logic of a NullValue object is always the same and allows us to cache it in a single instance. Less object allocation should also reduce garbage collection pressure.
This strategy is well known and is used in the Java ecosystem very frequently (e.g Collections.emptyList() or BigDecimal.ZERO), so this is not a novel or untested approach.
I heavily use NullValues and I believe this pull request will help improving the overall performance of NullValue creation inside Value.java, as the logic of a NullValue object is always the same and allows us to cache it in a single instance. Less object allocation should also reduce garbage collection pressure.
This strategy is well known and is used in the Java ecosystem very frequently (e.g Collections.emptyList() or BigDecimal.ZERO), so this is not a novel or untested approach.