On Sun, 8 Sep 2024 07:52:26 GMT, Shaojin Wen <s...@openjdk.org> wrote:
> Similar to ObjectInputStream, use JLA.countPositives and > JLA.inflateBytesToChars to speed up readUTF In the readUTFAscii scenario, the performance is significantly improved, but in the readUTFSmall scenario, the performance is regressed. Here are the performance numbers on the MacBook M1 Pro: ## Script # baseline git checkout fbe2629303bcee5855673b7e37d8c49f19dc9849 make test TEST="micro:java.io.DataInputStreamTest.readUTF" # current git checkout 5c4bd6db977ca8729e078d26cb7ca284ab42203c make test TEST="micro:java.io.DataInputStreamTest.readUTF" ## Performance Numbers -# baseline -Benchmark Mode Cnt Score Error Units -DataInputStreamTest.readUTFAsciiLarge avgt 20 1.401 ? 0.005 us/op -DataInputStreamTest.readUTFAsciiMixed avgt 20 1.337 ? 0.092 us/op -DataInputStreamTest.readUTFAsciiSmall avgt 20 0.872 ? 0.004 us/op -DataInputStreamTest.readUTFLarge avgt 20 2.178 ? 0.050 us/op -DataInputStreamTest.readUTFMixed avgt 20 1.700 ? 0.109 us/op -DataInputStreamTest.readUTFSmall avgt 20 0.879 ? 0.012 us/op +# current +Benchmark Mode Cnt Score Error Units +DataInputStreamTest.readUTFAsciiLarge avgt 20 0.833 ? 0.004 us/op +DataInputStreamTest.readUTFAsciiMixed avgt 20 0.804 ? 0.001 us/op +DataInputStreamTest.readUTFAsciiSmall avgt 20 0.828 ? 0.005 us/op +DataInputStreamTest.readUTFLarge avgt 20 2.053 ? 0.063 us/op +DataInputStreamTest.readUTFMixed avgt 20 1.675 ? 0.056 us/op +DataInputStreamTest.readUTFSmall avgt 20 1.834 ? 0.026 us/op | | baseline | current | delta | | --- | --- | --- | --- | | DataInputStreamTest.readUTFAsciiLarge | 1.401 | 0.833 | 68.19% | | DataInputStreamTest.readUTFAsciiMixed | 1.337 | 0.804 | 66.29% | | DataInputStreamTest.readUTFAsciiSmall | 0.872 | 0.828 | 5.31% | | DataInputStreamTest.readUTFLarge | 2.178 | 2.053 | 6.09% | | DataInputStreamTest.readUTFMixed | 1.700 | 1.675 | 1.49% | | DataInputStreamTest.readUTFSmall | 0.879 | 1.834 | -52.07% | ------------- PR Comment: https://git.openjdk.org/jdk/pull/20903#issuecomment-2347702045