On Wed, 4 Jan 2023 10:49:24 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> Currently, `java.io.Bits` is using explicit logic to read/write various 
>> primitive types to/from byte arrays. Switching to the use of `VarHandle` 
>> access would provide better performance and less code. 
>> 
>> Also, using a standard API for these conversions means future `VarHandle` 
>> improvements will benefit `Bits` too. 
>> 
>> Improvements in `Bits` will propagate to `ObjectInputStream`, 
>> `ObjectOutputStream` and `RandomAccessFile`.
>> 
>> Initial benchmarks and performance discussions can be found here: 
>> https://github.com/openjdk/panama-foreign/pull/762
>
> Per Minborg has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Improve test
>  - Improve test

There *may* be one problem: For float and double the original code uses 
`Double#doubleToLongBits()` (same for float), which normalized NaN. I am not 
sure how the Varhandle behaves with that. Reading float/double is not a problem.

-------------

PR: https://git.openjdk.org/jdk/pull/11840

Reply via email to