RFR: 8336856: Efficient hidden class-based string concatenation strategy [v55]
Shaojin Wen
duke at openjdk.org
Wed Aug 14 09:11:03 UTC 2024
On Tue, 13 Aug 2024 16:34:18 GMT, Shaojin Wen <duke at openjdk.org> wrote:
>> This PR implements the same algorithm as the current generateMHInlineCopy based on bytecode to improve startup performance.
>
> Shaojin Wen has updated the pull request incrementally with two additional commits since the last revision:
>
> - static final
> - code style
I did a series of tests and found that compared with the original MH implementation, the startup performance of the current strategy is significantly improved, and the running performance is neutral.
# 1. Script
git remote add wenshao git at github.com:wenshao/jdk.git
git fetch wenshao
# baseline with test
git checkout e733e85eb35b4e67b9209656d287747075f03ece
make test TEST="micro:java.lang.StringConcat"
# current
git checkout 7d481ece8e008c3ae55f29d27d10cb59e86212a1
make test TEST="micro:java.lang.StringConcat"
# 2. Performance numbers
## 2.1 MacBook M1 Pro
[StringFormat.result_mbp_m1.txt](https://github.com/user-attachments/files/16610092/StringFormat.result_mbp_m1.txt)
| | baseline | current | delta |
| --- | --- | --- | --- |
| StringConcat.concat123String | 1005.645 | 1078.414 | -6.75% |
| StringConcat.concat13String | 45.914 | 45.657 | 0.56% |
| StringConcat.concat13StringConst | 72.296 | 65.621 | 10.17% |
| StringConcat.concat23String | 90.946 | 138.887 | -34.52% |
| StringConcat.concat23StringConst | 101.160 | 118.533 | -14.66% |
| StringConcat.concat30Mix | 266.559 | 438.586 | -39.22% |
| StringConcat.concat3String | 12.420 | 15.893 | -21.85% |
| StringConcat.concat4String | 13.885 | 22.751 | -38.97% |
| StringConcat.concat6String | 19.789 | 19.810 | -0.11% |
| StringConcat.concatConst2String | 9.503 | 8.654 | 9.81% |
| StringConcat.concatConst4String | 14.878 | 21.128 | -29.58% |
| StringConcat.concatConst6Object | 51.583 | 53.113 | -2.88% |
| StringConcat.concatConst6String | 19.642 | 19.662 | -0.10% |
| StringConcat.concatConstBool | 3.446 | 3.441 | 0.15% |
| StringConcat.concatConstBoolByte | 6.440 | 6.425 | 0.23% |
| StringConcat.concatConstBoolString | 7.066 | 7.812 | -9.55% |
| StringConcat.concatConstBoolean | 3.984 | 3.957 | 0.68% |
| StringConcat.concatConstBooleanConst | 4.871 | 4.876 | -0.10% |
| StringConcat.concatConstBooleanString | 7.299 | 8.528 | -14.41% |
| StringConcat.concatConstFloat | 56.994 | 53.250 | 7.03% |
| StringConcat.concatConstFloatConst | 55.126 | 54.495 | 1.16% |
| StringConcat.concatConstFloatString | 59.585 | 59.648 | -0.11% |
| StringConcat.concatConstInt | 6.077 | 5.893 | 3.12% |
| StringConcat.concatConstIntConst | 6.840 | 6.606 | 3.54% |
| StringConcat.concatConstIntConstInt | 9.792 | 9.813 | -0.21% |
| StringConcat.concatConstIntString | 14.788 | 11.129 | 32.88% |
| StringConcat.concatConstInteger | 4.025 | 4.002 | 0.57% |
| StringConcat.concatConstIntegerConst | 4.790 | 4.775 | 0.31% |
| StringConcat.concatConstIntegerString | 7.013 | 7.657 | -8.41% |
| StringConcat.concatConstObjectConst | 11.063 | 11.035 | 0.25% |
| StringConcat.concatConstString | 4.983 | 4.969 | 0.28% |
| StringConcat.concatConstStringConst | 8.095 | 6.145 | 31.73% |
| StringConcat.concatConstStringConstInt | 11.894 | 18.877 | -36.99% |
| StringConcat.concatEmptyConstInt | 5.611 | 5.625 | -0.25% |
| StringConcat.concatEmptyConstString | 2.044 | 2.065 | -1.02% |
| StringConcat.concatEmptyLeft | 2.230 | 2.226 | 0.18% |
| StringConcat.concatEmptyRight | 2.370 | 2.369 | 0.04% |
| StringConcat.concatMethodConstString | 5.001 | 4.974 | 0.54% |
| StringConcat.concatMix4String | 80.038 | 146.305 | -45.29% |
| StringConcat.concatStringBoolString | 20.103 | 8.626 | 133.05% |
| StringConcat.concatStringBooleanString | 10.896 | 8.574 | 27.08% |
| StringConcat.concatStringIntString | 18.690 | 11.587 | 61.30% |
| StringConcat.concatStringIntegerString | 9.034 | 8.414 | 7.37% |
| StringConcatStartup.MixedLarge.run | 314.747 | 154.531 | 103.68% |
| StringConcatStartup.MixedSmall.run | 24.384 | 7.222 | 237.64% |
| StringConcatStartup.StringLarge.run | 85.708 | 29.411 | 191.41% |
| StringConcatStartup.StringSingle.constBool | 2.116 | 0.439 | 382.00% |
| StringConcatStartup.StringSingle.constBoolString | 0.263 | 0.654 | -59.79% |
| StringConcatStartup.StringSingle.constBoolean | 0.140 | 0.125 | 12.00% |
| StringConcatStartup.StringSingle.constBooleanString | 3.523 | 0.927 | 280.04% |
| StringConcatStartup.StringSingle.constFloat | 2.625 | 0.568 | 362.15% |
| StringConcatStartup.StringSingle.constFloatString | 4.412 | 1.147 | 284.66% |
| StringConcatStartup.StringSingle.constInt | 2.046 | 0.432 | 373.61% |
| StringConcatStartup.StringSingle.constIntString | 0.154 | 0.096 | 60.42% |
| StringConcatStartup.StringSingle.constInteger | 0.141 | 0.123 | 14.63% |
| StringConcatStartup.StringSingle.constIntegerString | 3.513 | 0.893 | 293.39% |
| StringConcatStartup.StringSingle.constString | 0.142 | 0.122 | 16.39% |
| StringConcatStartup.StringThree.stringIntString | 6.058 | 1.410 | 329.65% |
| StringConcatStartup.StringThree.stringIntegerString | 5.031 | 0.930 | 440.97% |
## 2.2 Aliyun ECS c8a
* Linux AMD CPU (x64)
[StringFormat.result_aliyun_c8a.txt](https://github.com/user-attachments/files/16610085/StringFormat.result_aliyun_c8a.txt)
| | baseline | current | delta |
| --- | --- | --- | --- |
| StringConcat.concat123String | 1163.772 | 1521.357 | -23.50% |
| StringConcat.concat13String | 58.267 | 55.241 | 5.48% |
| StringConcat.concat13StringConst | 89.872 | 80.219 | 12.03% |
| StringConcat.concat23String | 117.712 | 166.671 | -29.37% |
| StringConcat.concat23StringConst | 111.839 | 139.034 | -19.56% |
| StringConcat.concat30Mix | 297.812 | 317.952 | -6.33% |
| StringConcat.concat3String | 12.825 | 12.552 | 2.17% |
| StringConcat.concat4String | 16.092 | 14.993 | 7.33% |
| StringConcat.concat6String | 22.840 | 21.629 | 5.60% |
| StringConcat.concatConst2String | 10.355 | 10.684 | -3.08% |
| StringConcat.concatConst4String | 16.866 | 18.053 | -6.58% |
| StringConcat.concatConst6Object | 49.952 | 50.241 | -0.58% |
| StringConcat.concatConst6String | 23.621 | 24.873 | -5.03% |
| StringConcat.concatConstBool | 3.317 | 3.274 | 1.31% |
| StringConcat.concatConstBoolByte | 6.381 | 5.532 | 15.35% |
| StringConcat.concatConstBoolString | 7.555 | 7.825 | -3.45% |
| StringConcat.concatConstBoolean | 3.573 | 3.578 | -0.14% |
| StringConcat.concatConstBooleanConst | 3.882 | 3.870 | 0.31% |
| StringConcat.concatConstBooleanString | 7.656 | 7.763 | -1.38% |
| StringConcat.concatConstFloat | 41.476 | 39.949 | 3.82% |
| StringConcat.concatConstFloatConst | 42.529 | 40.778 | 4.29% |
| StringConcat.concatConstFloatString | 44.946 | 45.346 | -0.88% |
| StringConcat.concatConstInt | 5.157 | 5.080 | 1.52% |
| StringConcat.concatConstIntConst | 5.695 | 5.723 | -0.49% |
| StringConcat.concatConstIntConstInt | 9.385 | 8.520 | 10.15% |
| StringConcat.concatConstIntString | 9.656 | 9.745 | -0.91% |
| StringConcat.concatConstInteger | 3.431 | 3.425 | 0.18% |
| StringConcat.concatConstIntegerConst | 3.761 | 3.763 | -0.05% |
| StringConcat.concatConstIntegerString | 7.862 | 7.979 | -1.47% |
| StringConcat.concatConstObjectConst | 12.002 | 12.340 | -2.74% |
| StringConcat.concatConstString | 5.556 | 5.514 | 0.76% |
| StringConcat.concatConstStringConst | 8.367 | 7.069 | 18.36% |
| StringConcat.concatConstStringConstInt | 12.663 | 12.489 | 1.39% |
| StringConcat.concatEmptyConstInt | 5.401 | 5.381 | 0.37% |
| StringConcat.concatEmptyConstString | 2.455 | 2.444 | 0.45% |
| StringConcat.concatEmptyLeft | 2.449 | 2.436 | 0.53% |
| StringConcat.concatEmptyRight | 2.591 | 2.573 | 0.70% |
| StringConcat.concatMethodConstString | 5.533 | 5.506 | 0.49% |
| StringConcat.concatMix4String | 82.134 | 84.020 | -2.24% |
| StringConcat.concatStringBoolString | 11.661 | 10.215 | 14.16% |
| StringConcat.concatStringBooleanString | 11.173 | 11.173 | 0.00% |
| StringConcat.concatStringIntString | 14.405 | 13.215 | 9.00% |
| StringConcat.concatStringIntegerString | 10.549 | 10.430 | 1.14% |
| StringConcatStartup.MixedLarge.run | 586.642 | 273.945 | 114.15% |
| StringConcatStartup.MixedSmall.run | 37.213 | 11.103 | 235.16% |
| StringConcatStartup.StringLarge.run | 140.629 | 46.256 | 204.02% |
| StringConcatStartup.StringSingle.constBool | 2.974 | 0.639 | 365.41% |
| StringConcatStartup.StringSingle.constBoolString | 0.356 | 0.928 | -61.64% |
| StringConcatStartup.StringSingle.constBoolean | 0.194 | 0.174 | 11.49% |
| StringConcatStartup.StringSingle.constBooleanString | 5.051 | 1.318 | 283.23% |
| StringConcatStartup.StringSingle.constFloat | 3.716 | 0.844 | 340.28% |
| StringConcatStartup.StringSingle.constFloatString | 6.204 | 1.708 | 263.23% |
| StringConcatStartup.StringSingle.constInt | 2.874 | 0.635 | 352.60% |
| StringConcatStartup.StringSingle.constIntString | 0.219 | 0.133 | 64.66% |
| StringConcatStartup.StringSingle.constInteger | 0.204 | 0.181 | 12.71% |
| StringConcatStartup.StringSingle.constIntegerString | 5.235 | 1.344 | 289.51% |
| StringConcatStartup.StringSingle.constString | 0.191 | 0.175 | 9.14% |
| StringConcatStartup.StringThree.stringIntString | 8.492 | 2.145 | 295.90% |
| StringConcatStartup.StringThree.stringIntegerString | 7.041 | 1.446 | 386.93% |
## 2.3 Aliyun ECS c8i
* Linux Intel CPU (x64)
[StringFormat.result_aliyun_c8i.txt](https://github.com/user-attachments/files/16610087/StringFormat.result_aliyun_c8i.txt)
| | baseline | current | delta |
| --- | --- | --- | --- |
| StringConcat.concat123String | 976.112 | 1362.079 | -28.34% |
| StringConcat.concat13String | 37.720 | 37.310 | 1.10% |
| StringConcat.concat13StringConst | 131.434 | 124.136 | 5.88% |
| StringConcat.concat23String | 133.983 | 106.415 | 25.91% |
| StringConcat.concat23StringConst | 172.257 | 148.726 | 15.82% |
| StringConcat.concat30Mix | 232.886 | 257.292 | -9.49% |
| StringConcat.concat3String | 8.113 | 7.907 | 2.61% |
| StringConcat.concat4String | 9.515 | 8.834 | 7.71% |
| StringConcat.concat6String | 13.369 | 12.307 | 8.63% |
| StringConcat.concatConst2String | 7.850 | 7.603 | 3.25% |
| StringConcat.concatConst4String | 10.727 | 10.240 | 4.76% |
| StringConcat.concatConst6Object | 46.214 | 43.903 | 5.26% |
| StringConcat.concatConst6String | 14.274 | 14.250 | 0.17% |
| StringConcat.concatConstBool | 6.646 | 6.681 | -0.52% |
| StringConcat.concatConstBoolByte | 8.365 | 7.891 | 6.01% |
| StringConcat.concatConstBoolString | 7.846 | 8.699 | -9.81% |
| StringConcat.concatConstBoolean | 7.075 | 6.867 | 3.03% |
| StringConcat.concatConstBooleanConst | 7.775 | 7.743 | 0.41% |
| StringConcat.concatConstBooleanString | 8.597 | 8.334 | 3.16% |
| StringConcat.concatConstFloat | 42.285 | 41.610 | 1.62% |
| StringConcat.concatConstFloatConst | 42.879 | 42.106 | 1.84% |
| StringConcat.concatConstFloatString | 44.812 | 44.550 | 0.59% |
| StringConcat.concatConstInt | 7.472 | 7.445 | 0.36% |
| StringConcat.concatConstIntConst | 7.948 | 8.055 | -1.33% |
| StringConcat.concatConstIntConstInt | 10.593 | 10.235 | 3.50% |
| StringConcat.concatConstIntString | 9.507 | 9.794 | -2.93% |
| StringConcat.concatConstInteger | 5.886 | 5.885 | 0.02% |
| StringConcat.concatConstIntegerConst | 7.203 | 7.182 | 0.29% |
| StringConcat.concatConstIntegerString | 7.729 | 7.634 | 1.24% |
| StringConcat.concatConstObjectConst | 16.048 | 16.491 | -2.69% |
| StringConcat.concatConstString | 6.567 | 6.593 | -0.39% |
| StringConcat.concatConstStringConst | 8.805 | 8.119 | 8.45% |
| StringConcat.concatConstStringConstInt | 10.376 | 11.351 | -8.59% |
| StringConcat.concatEmptyConstInt | 7.178 | 7.154 | 0.34% |
| StringConcat.concatEmptyConstString | 3.713 | 3.705 | 0.22% |
| StringConcat.concatEmptyLeft | 3.610 | 3.594 | 0.45% |
| StringConcat.concatEmptyRight | 3.554 | 3.642 | -2.42% |
| StringConcat.concatMethodConstString | 6.411 | 6.597 | -2.82% |
| StringConcat.concatMix4String | 54.681 | 56.998 | -4.07% |
| StringConcat.concatStringBoolString | 7.586 | 7.672 | -1.12% |
| StringConcat.concatStringBooleanString | 7.923 | 7.807 | 1.49% |
| StringConcat.concatStringIntString | 11.593 | 10.253 | 13.07% |
| StringConcat.concatStringIntegerString | 7.731 | 7.571 | 2.11% |
| StringConcatStartup.MixedLarge.run | 780.243 | 376.343 | 107.32% |
| StringConcatStartup.MixedSmall.run | 51.802 | 15.111 | 242.81% |
| StringConcatStartup.StringLarge.run | 192.342 | 60.500 | 217.92% |
| StringConcatStartup.StringSingle.constBool | 4.495 | 0.941 | 377.68% |
| StringConcatStartup.StringSingle.constBoolString | 0.528 | 1.243 | -57.52% |
| StringConcatStartup.StringSingle.constBoolean | 0.293 | 0.237 | 23.63% |
| StringConcatStartup.StringSingle.constBooleanString | 7.413 | 1.728 | 328.99% |
| StringConcatStartup.StringSingle.constFloat | 5.812 | 1.278 | 354.77% |
| StringConcatStartup.StringSingle.constFloatString | 9.359 | 2.310 | 305.15% |
| StringConcatStartup.StringSingle.constInt | 4.281 | 1.001 | 327.67% |
| StringConcatStartup.StringSingle.constIntString | 0.294 | 0.179 | 64.25% |
| StringConcatStartup.StringSingle.constInteger | 0.283 | 0.228 | 24.12% |
| StringConcatStartup.StringSingle.constIntegerString | 7.213 | 1.683 | 328.58% |
| StringConcatStartup.StringSingle.constString | 0.276 | 0.209 | 32.06% |
| StringConcatStartup.StringThree.stringIntString | 12.289 | 2.824 | 335.16% |
| StringConcatStartup.StringThree.stringIntegerString | 10.503 | 1.923 | 446.18% |
## 2.4 ALiyun ECS c8y
* Linux Arm CPU (aarch64)
[StringFormat.result_aliyun_c8y.txt](https://github.com/user-attachments/files/16610088/StringFormat.result_aliyun_c8y.txt)
| | baseline | current | delta |
| --- | --- | --- | --- |
| StringConcat.concat123String | 1193.343 | 1317.495 | -9.42% |
| StringConcat.concat13String | 50.786 | 45.430 | 11.79% |
| StringConcat.concat13StringConst | 194.426 | 164.292 | 18.34% |
| StringConcat.concat23String | 145.115 | 120.893 | 20.04% |
| StringConcat.concat23StringConst | 229.838 | 226.715 | 1.38% |
| StringConcat.concat30Mix | 319.229 | 364.161 | -12.34% |
| StringConcat.concat3String | 10.958 | 10.370 | 5.67% |
| StringConcat.concat4String | 12.897 | 11.632 | 10.88% |
| StringConcat.concat6String | 16.710 | 15.167 | 10.17% |
| StringConcat.concatConst2String | 18.325 | 10.500 | 74.52% |
| StringConcat.concatConst4String | 17.919 | 13.252 | 35.22% |
| StringConcat.concatConst6Object | 87.184 | 81.847 | 6.52% |
| StringConcat.concatConst6String | 20.055 | 20.952 | -4.28% |
| StringConcat.concatConstBool | 9.528 | 9.090 | 4.82% |
| StringConcat.concatConstBoolByte | 15.628 | 14.653 | 6.65% |
| StringConcat.concatConstBoolString | 15.861 | 11.606 | 36.66% |
| StringConcat.concatConstBoolean | 10.753 | 10.076 | 6.72% |
| StringConcat.concatConstBooleanConst | 12.083 | 12.422 | -2.73% |
| StringConcat.concatConstBooleanString | 12.770 | 13.067 | -2.27% |
| StringConcat.concatConstFloat | 51.561 | 50.420 | 2.26% |
| StringConcat.concatConstFloatConst | 53.687 | 52.982 | 1.33% |
| StringConcat.concatConstFloatString | 53.466 | 53.410 | 0.10% |
| StringConcat.concatConstInt | 10.845 | 9.828 | 10.35% |
| StringConcat.concatConstIntConst | 12.712 | 11.287 | 12.63% |
| StringConcat.concatConstIntConstInt | 14.058 | 13.670 | 2.84% |
| StringConcat.concatConstIntString | 13.832 | 16.458 | -15.96% |
| StringConcat.concatConstInteger | 11.899 | 11.111 | 7.09% |
| StringConcat.concatConstIntegerConst | 13.850 | 13.887 | -0.27% |
| StringConcat.concatConstIntegerString | 15.831 | 14.525 | 8.99% |
| StringConcat.concatConstObjectConst | 26.479 | 26.881 | -1.50% |
| StringConcat.concatConstString | 10.044 | 9.380 | 7.08% |
| StringConcat.concatConstStringConst | 13.301 | 11.200 | 18.76% |
| StringConcat.concatConstStringConstInt | 15.919 | 18.425 | -13.60% |
| StringConcat.concatEmptyConstInt | 10.591 | 10.235 | 3.48% |
| StringConcat.concatEmptyConstString | 6.376 | 6.076 | 4.94% |
| StringConcat.concatEmptyLeft | 6.432 | 6.170 | 4.25% |
| StringConcat.concatEmptyRight | 6.225 | 6.111 | 1.87% |
| StringConcat.concatMethodConstString | 9.718 | 9.552 | 1.74% |
| StringConcat.concatMix4String | 73.730 | 75.615 | -2.49% |
| StringConcat.concatStringBoolString | 10.388 | 9.894 | 4.99% |
| StringConcat.concatStringBooleanString | 10.968 | 11.110 | -1.28% |
| StringConcat.concatStringIntString | 12.599 | 12.020 | 4.82% |
| StringConcat.concatStringIntegerString | 11.930 | 11.939 | -0.08% |
| StringConcatStartup.MixedLarge.run | 724.882 | 320.302 | 126.31% |
| StringConcatStartup.MixedSmall.run | 48.453 | 14.320 | 238.36% |
| StringConcatStartup.StringLarge.run | 158.741 | 51.739 | 206.81% |
| StringConcatStartup.StringSingle.constBool | 3.845 | 0.816 | 371.20% |
| StringConcatStartup.StringSingle.constBoolString | 0.388 | 1.148 | -66.20% |
| StringConcatStartup.StringSingle.constBoolean | 0.243 | 0.200 | 21.50% |
| StringConcatStartup.StringSingle.constBooleanString | 6.473 | 1.580 | 309.68% |
| StringConcatStartup.StringSingle.constFloat | 4.755 | 1.072 | 343.56% |
| StringConcatStartup.StringSingle.constFloatString | 8.233 | 2.019 | 307.78% |
| StringConcatStartup.StringSingle.constInt | 3.724 | 0.800 | 365.50% |
| StringConcatStartup.StringSingle.constIntString | 0.209 | 0.145 | 44.14% |
| StringConcatStartup.StringSingle.constInteger | 0.232 | 0.197 | 17.77% |
| StringConcatStartup.StringSingle.constIntegerString | 6.561 | 1.540 | 326.04% |
| StringConcatStartup.StringSingle.constString | 0.238 | 0.193 | 23.32% |
| StringConcatStartup.StringThree.stringIntString | 11.319 | 2.662 | 325.21% |
| StringConcatStartup.StringThree.stringIntegerString | 9.637 | 1.625 | 493.05% |
## 2.5 AWS ECS C5
* Linux Intel CPU (x65)
[StringFormat.result_aws_c5.txt](https://github.com/user-attachments/files/16610089/StringFormat.result_aws_c5.txt)
| | baseline | current | delta |
| --- | --- | --- | --- |
| StringConcat.concat123String | 2278.946 | 2498.133 | -8.77% |
| StringConcat.concat13String | 99.197 | 95.471 | 3.90% |
| StringConcat.concat13StringConst | 192.350 | 174.860 | 10.00% |
| StringConcat.concat23String | 237.929 | 324.679 | -26.72% |
| StringConcat.concat23StringConst | 271.060 | 284.983 | -4.89% |
| StringConcat.concat30Mix | 556.924 | 607.789 | -8.37% |
| StringConcat.concat3String | 22.134 | 20.345 | 8.79% |
| StringConcat.concat4String | 28.023 | 25.839 | 8.45% |
| StringConcat.concat6String | 41.292 | 38.681 | 6.75% |
| StringConcat.concatConst2String | 16.730 | 16.828 | -0.58% |
| StringConcat.concatConst4String | 29.613 | 29.629 | -0.05% |
| StringConcat.concatConst6Object | 85.482 | 82.400 | 3.74% |
| StringConcat.concatConst6String | 42.033 | 42.510 | -1.12% |
| StringConcat.concatConstBool | 7.067 | 6.994 | 1.04% |
| StringConcat.concatConstBoolByte | 9.980 | 9.053 | 10.24% |
| StringConcat.concatConstBoolString | 13.256 | 12.798 | 3.58% |
| StringConcat.concatConstBoolean | 7.528 | 7.432 | 1.29% |
| StringConcat.concatConstBooleanConst | 8.712 | 8.661 | 0.59% |
| StringConcat.concatConstBooleanString | 13.337 | 12.514 | 6.58% |
| StringConcat.concatConstFloat | 60.324 | 59.159 | 1.97% |
| StringConcat.concatConstFloatConst | 61.755 | 60.417 | 2.21% |
| StringConcat.concatConstFloatString | 68.358 | 70.086 | -2.47% |
| StringConcat.concatConstInt | 8.657 | 8.977 | -3.56% |
| StringConcat.concatConstIntConst | 9.255 | 9.251 | 0.04% |
| StringConcat.concatConstIntConstInt | 13.937 | 13.282 | 4.93% |
| StringConcat.concatConstIntString | 15.815 | 15.634 | 1.16% |
| StringConcat.concatConstInteger | 6.757 | 6.724 | 0.49% |
| StringConcat.concatConstIntegerConst | 8.080 | 8.051 | 0.36% |
| StringConcat.concatConstIntegerString | 13.460 | 12.847 | 4.77% |
| StringConcat.concatConstObjectConst | 19.584 | 19.376 | 1.07% |
| StringConcat.concatConstString | 9.148 | 9.162 | -0.15% |
| StringConcat.concatConstStringConst | 12.574 | 11.360 | 10.69% |
| StringConcat.concatConstStringConstInt | 16.472 | 17.830 | -7.62% |
| StringConcat.concatEmptyConstInt | 9.418 | 9.485 | -0.71% |
| StringConcat.concatEmptyConstString | 4.027 | 4.018 | 0.22% |
| StringConcat.concatEmptyLeft | 4.284 | 4.285 | -0.02% |
| StringConcat.concatEmptyRight | 4.392 | 4.400 | -0.18% |
| StringConcat.concatMethodConstString | 9.076 | 9.186 | -1.20% |
| StringConcat.concatMix4String | 158.463 | 152.295 | 4.05% |
| StringConcat.concatStringBoolString | 18.256 | 16.784 | 8.77% |
| StringConcat.concatStringBooleanString | 18.087 | 16.824 | 7.51% |
| StringConcat.concatStringIntString | 22.540 | 21.448 | 5.09% |
| StringConcat.concatStringIntegerString | 17.860 | 17.747 | 0.64% |
| StringConcatStartup.MixedLarge.run | 914.410 | 416.416 | 119.59% |
| StringConcatStartup.MixedSmall.run | 58.886 | 17.765 | 231.47% |
| StringConcatStartup.StringLarge.run | 220.709 | 70.726 | 212.06% |
| StringConcatStartup.StringSingle.constBool | 4.955 | 1.062 | 366.57% |
| StringConcatStartup.StringSingle.constBoolString | 0.576 | 1.520 | -62.11% |
| StringConcatStartup.StringSingle.constBoolean | 0.311 | 0.263 | 18.25% |
| StringConcatStartup.StringSingle.constBooleanString | 8.322 | 2.145 | 287.97% |
| StringConcatStartup.StringSingle.constFloat | 6.136 | 1.396 | 339.54% |
| StringConcatStartup.StringSingle.constFloatString | 10.110 | 2.803 | 260.68% |
| StringConcatStartup.StringSingle.constInt | 4.814 | 1.073 | 348.65% |
| StringConcatStartup.StringSingle.constIntString | 0.312 | 0.202 | 54.46% |
| StringConcatStartup.StringSingle.constInteger | 0.294 | 0.278 | 5.76% |
| StringConcatStartup.StringSingle.constIntegerString | 8.129 | 2.123 | 282.90% |
| StringConcatStartup.StringSingle.constString | 0.283 | 0.253 | 11.86% |
| StringConcatStartup.StringThree.stringIntString | 14.069 | 3.514 | 300.37% |
| StringConcatStartup.StringThree.stringIntegerString | 11.896 | 2.206 | 439.26% |
# 3. Summary:
1. The startup performance has been significantly improved, but the scenario StringConcatStartup.StringSingle.constBoolString has decreased, which is surprising. It may be that the JVM was warmed up during startup.
2. When the number of parameters is greater than the default inline threshold of 16, some scenarios will have performance regression, such as
StringConcat.concat123String
StringConcat.concat30Mix
These scenarios were originally implemented based on StringBuilder, not compared with MH. Whether to ignore or add StringBuilder implementation in the code.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20273#issuecomment-2288243097
More information about the core-libs-dev
mailing list