RFR: 8254078: DataOutputStream is very slow post-disabling of Biased Locking [v4]
Andrew Haley
aph at openjdk.java.net
Mon Oct 12 18:12:32 UTC 2020
On Fri, 9 Oct 2020 14:13:36 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Andrew Haley has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8254078: DataOutputStream is very slow post-disabling of Biased Locking
>
> test/micro/org/openjdk/bench/java/io/DataOutputStreamTest.java line 117:
>
>> 115: case STRING: writeString(state, dataOutput); break;
>> 116: }
>> 117: }
>
> So, the way I see it, this can be replaced by:
>
> public void write(DataOutput dataOutput) {
> switch (basicType) {
> case CHAR:
> for (int i = 0; i < SIZE; i += 2) {
> dataOutput.writeChar(i);
> }
> break;
> case SHORT:
> for (int i = 0; i < SIZE; i += 2) {
> dataOutput.writeShort(i);
> }
> break;
> case INT:
> for (int i = 0; i < SIZE; i += 4) {
> dataOutput.writeInt(i);
> }
> break;
> case STRING:
> dataOutput.writeChars(state.outputString);
> break;
> }
> }
>
> ...thus keeping all the code in one place, and simplifying the benchmark.
I didn't quite do that, preferring to keep the writeX functions separate.
-------------
PR: https://git.openjdk.java.net/jdk/pull/542
More information about the core-libs-dev
mailing list