On Mon, 4 Aug 2025 15:51:59 GMT, Galder Zamarreño <gal...@openjdk.org> wrote:

>> test/micro/org/openjdk/bench/java/lang/VectorBitConversion.java line 67:
>> 
>>> 65: 
>>> 66:     @Benchmark
>>> 67:     public long[] doubleToLongBits() {
>> 
>> Would something like this be more concise (and maybe more readable as well) 
>> - 
>> 
>> @Benchmark
>> public long[] doubleToLongBits() {
>>     for (int i = 0; i < doubles.length; i++) {
>>         resultLongs[i] = Double.doubleToLongBits(doubles[i]);
>>     }
>>     return resultLongs;
>> }
>> 
>> 
>> The loop should still get vectorized (if vectorizable).
>> 
>> Same for other benchmarks.
>
> Maybe but there's a reason why I wrote these benchmark methods this way. 
> Keeping each line doing one thing makes it easier to map each line to the 
> assembly (e.g. `perfasm`) and related IR nodes (e.g. `PrintIdeal`). That IMO 
> is more important than the conciseness of the benchmark. What do others think?

Makes sense. Thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26457#discussion_r2252475557

Reply via email to