RFR: 8352316: More MergeStoreBench

Shaojin Wen swen at openjdk.org
Sat Mar 29 01:13:30 UTC 2025


On Fri, 28 Mar 2025 22:22:33 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> On naming:
> 
> * `null` usages confuse me (`NULL_STR` et al, `putNull`). Why "null" is special? Can you just use an arbitrary 4-byte string?

"null" is very common, here, because its length is 4. When coder = LATIN1, the length of byte[] value is 4, and when coder = UTF16, the length of byte[] value is 8, which is easy to compare with Unsafe.putInt/putLong.

If the string is not a multiple of 4, we can also use a combination. For example, when the length is 5, we can use the putInt + putByte combination.


String str = "a1234";
str.getBytes(bytes, 0, 5, bytes, off);



UNSAFE.putInt(bytes, Unsafe.ARRAY_BYTE_BASE_OFFSET + off, 0x33323161); // 0x33323161 is "a123"
USNAFE.putByte(bytes, Unsafe.ARRAY_BYTE_BASE_OFFSET + off + 4, '4');


> * PR proposes a mix of snake & camel case while the code around uses camel case. Worth considering grouping similar benchmarks into an inner class.

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

PR Comment: https://git.openjdk.org/jdk/pull/24108#issuecomment-2762963689


More information about the hotspot-compiler-dev mailing list