Revert "util: Simplify non-copy string-[]byte conversion"#11860
Revert "util: Simplify non-copy string-[]byte conversion"#11860sre-bot merged 5 commits intopingcap:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11860 +/- ##
================================================
+ Coverage 81.1224% 81.7801% +0.6576%
================================================
Files 454 453 -1
Lines 98535 98848 +313
================================================
+ Hits 79934 80838 +904
+ Misses 12843 12379 -464
+ Partials 5758 5631 -127 |
winoros
left a comment
There was a problem hiding this comment.
could we add a benchmark test for the case you mentioned?
We have a |
| // Use it at your own risk. | ||
| func String(b []byte) MutableString { | ||
| return *(*MutableString)(unsafe.Pointer(&b)) | ||
| func String(b []byte) (s MutableString) { |
There was a problem hiding this comment.
Can you provide a benchmark for this function and provide comparable results before and after.
|
/bench |
@@ Benchmark Diff @@
================================================================================
--- tidb: 3de23f0f7c85b0338dd39d8318d1e4ffc75f04f3
+++ tidb: 69bfc26dfc40b75fe93dddcab0918ab18acea5d3
tikv: d3a800f30405c30d3eb3138987228829a55d52f7
pd: 14b91e8fbe3c172adcae880e3b858379e3d90eff
================================================================================
test-1: < oltp_insert >
* QPS : 21443.48 ± 0.2482% (std=40.36) delta: -0.26%
* AvgMs : 11.93 ± 0.2682% (std=0.02) delta: 0.25%
* PercentileMs99 : 42.77 ± 2.1510% (std=0.58) delta: 0.38%
test-2: < oltp_update_non_index >
* QPS : 29189.86 ± 0.4338% (std=77.34) delta: -1.53%
* AvgMs : 8.77 ± 0.4334% (std=0.02) delta: 1.53%
* PercentileMs99 : 31.03 ± 1.0827% (std=0.27) delta: 1.45%
test-3: < oltp_read_write >
* QPS : 33261.37 ± 0.1679% (std=36.09) delta: 0.46%
* AvgMs : 154.63 ± 0.1759% (std=0.17) delta: -0.45%
* PercentileMs99 : 287.38 ± 0.0000% (std=0.00) delta: 0.00%
test-4: < oltp_point_select >
* QPS : 76184.75 ± 1.0472% (std=570.05) delta: -0.05%
* AvgMs : 3.36 ± 1.1316% (std=0.03) delta: 0.01%
* PercentileMs99 : 7.30 ± 0.0000% (std=0.00) delta: -0.71%
test-5: < oltp_update_index >
* QPS : 17106.97 ± 0.3416% (std=35.34) delta: 0.14%
* AvgMs : 14.96 ± 0.3475% (std=0.03) delta: -0.14%
* PercentileMs99 : 48.34 ± 0.0000% (std=0.00) delta: 0.00%
|
|
@suzaku maybe we should update branch and benchmark again |
|
/bench |
@@ Benchmark Diff @@
================================================================================
--- tidb: 3de23f0f7c85b0338dd39d8318d1e4ffc75f04f3
+++ tidb: f36fff303191a32d553659a09efa2da7664765a7
tikv: d3a800f30405c30d3eb3138987228829a55d52f7
pd: 14b91e8fbe3c172adcae880e3b858379e3d90eff
================================================================================
test-1: < oltp_insert >
* QPS : 21583.11 ± 0.4220% (std=63.57) delta: 0.39%
* AvgMs : 11.86 ± 0.4555% (std=0.04) delta: -0.39%
* PercentileMs99 : 42.31 ± 1.0779% (std=0.37) delta: -0.71%
test-2: < oltp_update_non_index >
* QPS : 29615.82 ± 0.0270% (std=5.66) delta: -0.09%
* AvgMs : 8.64 ± 0.0000% (std=0.00) delta: 0.05%
* PercentileMs99 : 30.26 ± 0.0000% (std=0.00) delta: -1.08%
test-3: < oltp_read_write >
* QPS : 33397.57 ± 0.4986% (std=106.28) delta: 0.87%
* AvgMs : 154.00 ± 0.4935% (std=0.49) delta: -0.86%
* PercentileMs99 : 287.38 ± 0.0000% (std=0.00) delta: 0.00%
test-4: < oltp_point_select >
* QPS : 75895.75 ± 1.5588% (std=663.44) delta: -0.43%
* AvgMs : 3.36 ± 0.6701% (std=0.01) delta: 0.00%
* PercentileMs99 : 7.38 ± 1.0572% (std=0.06) delta: 0.35%
test-5: < oltp_update_index >
* QPS : 17159.77 ± 0.5823% (std=77.55) delta: 0.45%
* AvgMs : 14.92 ± 0.5899% (std=0.07) delta: -0.43%
* PercentileMs99 : 47.82 ± 1.0916% (std=0.43) delta: -1.08%
|
|
@suzaku Can we close this PR? Seems it's not help with the performance? |
|
@mahjonp According to the benchmark result, reverting the change doesn't seem to fix the performance regression? |
|
@zz-jason sorry, I will bench with batch_insert workload later, please wait a moment. |
there is batch insert benchmark result, @zz-jason PTAL |
|
/run-all-tests |
This reverts commit e954a5a.
What problem does this PR solve?
Commit
e954a5a12239a1b8dab01d68f89f1270b08762a5causes a reproducible performanceregression for the case
insert_batch.The original implementation would return directly if the input is empty,
so we try to fix this problem by adding the shortcut for empty inputs in
#11828.
But it turns out the regression is still there.
What is changed and how it works?
Revert the change.
Check List
Tests
Code changes
Side effects
Related changes