Re: RFR: 8334342: Add MergeStore JMH benchmarks [v5]

2024-07-24 Thread Emanuel Peter
On Tue, 18 Jun 2024 01:09:49 GMT, Shaojin Wen  wrote:

>> Shaojin Wen has updated the pull request with a new target base due to a 
>> merge or a rebase. The incremental webrev excludes the unrelated changes 
>> brought in by the merge/rebase. The pull request contains 13 additional 
>> commits since the last revision:
>> 
>>  - Merge remote-tracking branch 'upstream/master' into merge_store_bench
>>  - bug fix for `putChars4C`
>>  - bug fix for `putChars4C` and `putChars4S`
>>  - use VarHandler CHAR_L & CHAR_B
>>  - copyright
>>  - bug fix for putIntBU
>>  - add cases for `getChar` & `putChar`
>>  - code format
>>  - add `setIntRL` & `setIntRLU`
>>  - add comments
>>  - ... and 3 more: https://git.openjdk.org/jdk/compare/322c6e37...4c9b9418
>
> I re-ran the performance test based on WebRevs 04: 
> [Full](https://webrevs.openjdk.org/?repo=jdk&pr=19734&range=04) - 
> [Incremental](https://webrevs.openjdk.org/?repo=jdk&pr=19734&range=03-04) 
> ([4c9b9418](https://git.openjdk.org/jdk/pull/19734/files/4c9b9418fc4a95504867b6019b3e94605917f747))
>  .
> 
> # 1. Cases MergeStore does not work
> @eme64 
> I found `putChars4BV` and `putChars4LV` two cases MergeStore didn't work, if 
> support can be enhanced, it would be useful for people using VarHandle.
> 
> 
> putChars4BV
> putChars4LV
> 
> 
> I also found that the performance of the case using VarHandle is particularly 
> good. Why? For example:
> 
> setIntBV
> setIntLV
> setLongBV
> setLongLV
> 
> 
> # 2. Performance numbers
> The names of these cases have the following B/L/V/U suffixes, which are:
> 
> B BigEndian
> L LittleEndian
> V VarHandle
> U Unsafe
> R reverseBytes
> C Unsafe.getChar & putChar
> S Unsafe.getShort & putShort
> 
> 
> ## 2.1 MacBook M1 Pro (aarch64)
> 
> BenchmarkMode  Cnt  ScoreError  Units
> MergeStoreBench.getCharB avgt   15   5340.200 ?  7.038  ns/op
> MergeStoreBench.getCharBUavgt   15   5482.163 ?  7.922  ns/op
> MergeStoreBench.getCharBVavgt   15   5074.165 ?  6.759  ns/op
> MergeStoreBench.getCharC avgt   15   5051.763 ?  6.552  ns/op
> MergeStoreBench.getCharL avgt   15   5374.464 ?  9.783  ns/op
> MergeStoreBench.getCharLUavgt   15   5487.532 ?  6.368  ns/op
> MergeStoreBench.getCharLVavgt   15   5071.263 ?  9.717  ns/op
> MergeStoreBench.getIntB  avgt   15   6277.984 ?  6.284  ns/op
> MergeStoreBench.getIntBU avgt   15   5232.984 ? 10.384  ns/op
> MergeStoreBench.getIntBV avgt   15   1206.264 ?  1.193  ns/op
> MergeStoreBench.getIntL  avgt   15   6172.779 ?  1.962  ns/op
> MergeStoreBench.getIntLU avgt   15   5157.317 ? 16.077  ns/op
> MergeStoreBench.getIntLV avgt   15   2558.110 ?  3.402  ns/op
> MergeStoreBench.getIntRB avgt   15   6889.916 ? 36.955  ns/op
> MergeStoreBench.getIntRBUavgt   15   5769.950 ? 11.499  ns/op
> MergeStoreBench.getIntRL avgt   15   6625.605 ? 10.662  ns/op
> MergeStoreBench.getIntRLUavgt   15   5746.742 ? 11.945  ns/op
> MergeStoreBench.getIntRU avgt   15   2544.586 ?  2.769  ns/op
> MergeStoreBench.getIntU  avgt   15   2541.119 ?  3.252  ns/op
> MergeStoreBench.getLongB avgt   15  12098.129 ? 31.451  ns/op
> MergeStoreBench.getLongBUavgt   15   9760.621 ? 16.427  ns/op
> MergeStoreBench.getLongBVavgt   15   2593.635 ?  4.698  ns/op
> MergeStoreBench.getLongL avgt   15  12031.065 ? 19.820  ns/op
> Merge...

@wenshao what is the state of this PR?

-

PR Comment: https://git.openjdk.org/jdk/pull/19734#issuecomment-2247964317


Re: RFR: 8334342: Add MergeStore JMH benchmarks [v5]

2024-06-17 Thread Shaojin Wen
On Mon, 17 Jun 2024 23:02:47 GMT, Shaojin Wen  wrote:

>> [8318446](https://github.com/openjdk/jdk/pull/16245)  brings MergeStore. We 
>> need a JMH Benchmark to evaluate the performance of various batch operations 
>> and the effect of MergeStore.
>
> Shaojin Wen has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 13 additional 
> commits since the last revision:
> 
>  - Merge remote-tracking branch 'upstream/master' into merge_store_bench
>  - bug fix for `putChars4C`
>  - bug fix for `putChars4C` and `putChars4S`
>  - use VarHandler CHAR_L & CHAR_B
>  - copyright
>  - bug fix for putIntBU
>  - add cases for `getChar` & `putChar`
>  - code format
>  - add `setIntRL` & `setIntRLU`
>  - add comments
>  - ... and 3 more: https://git.openjdk.org/jdk/compare/d4942ac0...4c9b9418

I re-ran the performance test based on WebRevs 04: 
[Full](https://webrevs.openjdk.org/?repo=jdk&pr=19734&range=04) - 
[Incremental](https://webrevs.openjdk.org/?repo=jdk&pr=19734&range=03-04) 
([4c9b9418](https://git.openjdk.org/jdk/pull/19734/files/4c9b9418fc4a95504867b6019b3e94605917f747))
 .

# 1. Cases MergeStore does not work
@eme64 
I found `putChars4BV` and `putChars4LV` to be two cases where MergeStore didn't 
work, if support can be enhanced, it would be useful for people using VarHandle.


putChars4BV
putChars4LV


I also found that the performance of the case using VarHandle is particularly 
good. Why? For example:

setIntBV
setIntLV
setLongBV
setLongLV


# 2. Performance numbers
The names of these cases have the following B/L/V/U suffixes, which are:

B BigEndian
L LittleEndian
V VarHandle
U Unsafe
R reverseBytes
C Unsafe.getChar & putChar
S Unsafe.getShort & putShort


## 2.1 MacBook M1 Pro (aarch64)

BenchmarkMode  Cnt  ScoreError  Units
MergeStoreBench.getCharB avgt   15   5340.200 ?  7.038  ns/op
MergeStoreBench.getCharBUavgt   15   5482.163 ?  7.922  ns/op
MergeStoreBench.getCharBVavgt   15   5074.165 ?  6.759  ns/op
MergeStoreBench.getCharC avgt   15   5051.763 ?  6.552  ns/op
MergeStoreBench.getCharL avgt   15   5374.464 ?  9.783  ns/op
MergeStoreBench.getCharLUavgt   15   5487.532 ?  6.368  ns/op
MergeStoreBench.getCharLVavgt   15   5071.263 ?  9.717  ns/op
MergeStoreBench.getIntB  avgt   15   6277.984 ?  6.284  ns/op
MergeStoreBench.getIntBU avgt   15   5232.984 ? 10.384  ns/op
MergeStoreBench.getIntBV avgt   15   1206.264 ?  1.193  ns/op
MergeStoreBench.getIntL  avgt   15   6172.779 ?  1.962  ns/op
MergeStoreBench.getIntLU avgt   15   5157.317 ? 16.077  ns/op
MergeStoreBench.getIntLV avgt   15   2558.110 ?  3.402  ns/op
MergeStoreBench.getIntRB avgt   15   6889.916 ? 36.955  ns/op
MergeStoreBench.getIntRBUavgt   15   5769.950 ? 11.499  ns/op
MergeStoreBench.getIntRL avgt   15   6625.605 ? 10.662  ns/op
MergeStoreBench.getIntRLUavgt   15   5746.742 ? 11.945  ns/op
MergeStoreBench.getIntRU avgt   15   2544.586 ?  2.769  ns/op
MergeStoreBench.getIntU  avgt   15   2541.119 ?  3.252  ns/op
MergeStoreBench.getLongB avgt   15  12098.129 ? 31.451  ns/op
MergeStoreBench.getLongBUavgt   15   9760.621 ? 16.427  ns/op
MergeStoreBench.getLongBVavgt   15   2593.635 ?  4.698  ns/op
MergeStoreBench.getLongL avgt   15  12031.065 ? 19.820  ns/op
MergeStoreBench.getLongLUavgt   15   9653.938 ? 18.372  ns/op
MergeStoreBench.getLongLVavgt   15   2557.521 ?  3.338  ns/op
MergeStoreBench.getLongRBavgt   15  12092.061 ? 18.026  ns/op
MergeStoreBench.getLongRBU   avgt   15   9763.489 ? 17.347  ns/op
MergeStoreBench.getLongRLavgt   15  12027.686 ? 17.472  ns/op
MergeStoreBench.getLongRLU   avgt   15   9649.433 ?  8.384  ns/op
MergeStoreBench.getLongRUavgt   15   2546.239 ?  2.088  ns/op
MergeStoreBench.getLongU avgt   15   2539.762 ?  1.439  ns/op
MergeStoreBench.putChars4B   avgt   15   8487.381 ? 23.170  ns/op
MergeStoreBench.putChars4BU  avgt   15   3830.198 ?  7.083  ns/op
MergeStoreBench.putChars4BV  avgt   15   5154.819 ? 10.348  ns/op
MergeStoreBench.putChars4C   avgt   15   5162.766 ? 15.041  ns/op
MergeStoreBench.putChars4L   avgt   15   8381.231 ? 20.135  ns/op
MergeStoreBench.putChars4LU  avgt   15   3827.784 ?  3.163  ns/op
MergeStoreBench.putChars4LV  avgt   15   5151.508 ?  4.907  ns/op
MergeStoreBench.putChars4S   avgt   15   5152.123 ?  7.407  ns/op
MergeStoreBench.setCharBSavgt   15   5317.319 ? 28.445  ns/op
MergeStoreBench.setCharBVavgt   15   5175.400 ?  7.110  ns/op
MergeStoreBench.setCharC avgt   15   5085.752 ?  6.222  ns/op
MergeStoreBench.setCharLSavgt   15   5294.766 ?  9.742  ns/op
MergeStoreBench.setCharLVavgt   15   5108.269 ?  6.692  ns/op
MergeStoreBench.setIntB  avgt   15   5095.236 ?  2.838  ns/op
MergeStoreBench.setIntBU avgt   15   5097.007 ?  4.249  ns/op
MergeStoreBench.setIntBV avgt  

Re: RFR: 8334342: Add MergeStore JMH benchmarks [v5]

2024-06-17 Thread Shaojin Wen
> [8318446](https://github.com/openjdk/jdk/pull/16245)  brings MergeStore. We 
> need a JMH Benchmark to evaluate the performance of various batch operations 
> and the effect of MergeStore.

Shaojin Wen has updated the pull request with a new target base due to a merge 
or a rebase. The incremental webrev excludes the unrelated changes brought in 
by the merge/rebase. The pull request contains 13 additional commits since the 
last revision:

 - Merge remote-tracking branch 'upstream/master' into merge_store_bench
 - bug fix for `putChars4C`
 - bug fix for `putChars4C` and `putChars4S`
 - use VarHandler CHAR_L & CHAR_B
 - copyright
 - bug fix for putIntBU
 - add cases for `getChar` & `putChar`
 - code format
 - add `setIntRL` & `setIntRLU`
 - add comments
 - ... and 3 more: https://git.openjdk.org/jdk/compare/fc9315ff...4c9b9418

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/19734/files
  - new: https://git.openjdk.org/jdk/pull/19734/files/1140bd81..4c9b9418

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19734&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19734&range=03-04

  Stats: 1440 lines in 77 files changed: 795 ins; 459 del; 186 mod
  Patch: https://git.openjdk.org/jdk/pull/19734.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19734/head:pull/19734

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