RFR: 8299982: (bf) Buffer.checkIndex(int, int) should use Preconditions.checkIndex(int, int, BiFunction) [v4]

Brian Burkhalter bpb at openjdk.org
Thu Jan 26 20:12:26 UTC 2023


On Thu, 26 Jan 2023 18:52:45 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Replace explicit check of indexes in `Buffer::checkIndex(int,int)` with a call to `Objects::checkIndex(int,int)` in order to improve the throughput of other methods which invoke `Buffer::checkIndex(int,int)`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8299982: Change exception formatter to a constant

Performance of integrated version

**Average Execution Time of `ByteBuffer::getLong(int)` in ns/op**

| size | before  | after  |
|------|---------|--------|
|   1  |   7.711 |  6.288 |
|   2  |   8.473 |  6.854 |
|  16  |  16.517 | 13.387 |
|  64  |  35.953 | 30.016 |
| 256  | 114.647 | 86.018 |

**Average Execution Time of `ByteBuffer::putLong(int, long)` in ns/op**

| size | before  | after  |
|------|---------|--------|
|   1  |   5.074 |  3.734 |
|   2  |   5.994 |  4.471 |
|  16  |  14.442 | 10.472 |
|  64  |  34.382 | 27.297 |
| 256  | 150.887 | 84.148 |

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

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


More information about the nio-dev mailing list