RFR: 8299576: Reimplement java.io.Bits using VarHandle access

Per Minborg pminborg at openjdk.org
Wed Jan 4 09:01:08 UTC 2023


On Wed, 4 Jan 2023 08:48:56 GMT, Per Minborg <pminborg at 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

Is there a better way to test packet-private methods in Bits without resorting to reflection?

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

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


More information about the core-libs-dev mailing list