Issue 162354
Summary [libc++] Investigate performance discrepancies with the unstable ABI
Labels libc++, performance
Assignees
Reporter ldionne
    I did an experiment where I ran all of libc++'s microbenchmarks with the stable and the unstable ABI. I found some interesting functions that seemed to be a lot slower with the stable ABI than the normal ABI. Those are the top ones:

```
Benchmark Normal ABI    Unstable ABI Difference    % Difference
------------------------------------------------------------------------------------------------------- ------------  --------------  ------------- --------------
SetIntersection_Interlaced_Vector_tuple<uint32,_uint64,_uint32>_262144_262144 350759492.31      1002002.85  -349757489.46 -99.71
rng::fill_n(vector<bool>)/262144 948.35          233.88 -714.47          -75.34
rng::fill(vector<bool>)/262144 900.82 235.03        -665.79          -73.91
std::fill(vector<bool>)/262144 874.51          235.02        -639.49 -73.13
rng::copy_n(vector<bool>)_(aligned)/1048576 2840.15         1038.96 -1801.19          -63.42
BM_Copy_SmallTrivialFunctor 1.24 0.49          -0.75          -60.53
BM_Copy_MemPtr 1.14 0.46          -0.68          -59.71
BM_Swap_FuncPtr_MemPtr 3.39            1.40          -1.99 -58.62
BM_Swap_MemFuncPtr_MemPtr 3.34            1.40 -1.94          -57.95
BM_Swap_FuncPtr_MemFuncPtr 3.29 1.40          -1.89          -57.38
BM_Swap_FuncPtr_SmallTrivialFunctor 3.26 1.40          -1.86          -56.97
std::fill(list<int>)/1024 1566.32          674.74        -891.58 -56.92
std::unordered_set<std::string>::insert(value)_(new_value)/8192 78.49           34.30 -44.19          -56.30
BM_Swap_MemPtr_SmallTrivialFunctor 3.18 1.40          -1.78          -55.92
BM_Swap_MemFuncPtr_SmallTrivialFunctor 3.19 1.44          -1.75          -54.87
BM_Copy_FuncPtr 1.14            0.53          -0.61 -53.57
BM_Swap_MemPtr_MemPtr 2.96            1.40 -1.55          -52.61
BM_Swap_MemFuncPtr_MemFuncPtr 2.96 1.40          -1.55          -52.54
BM_Swap_FuncPtr_FuncPtr 2.94 1.40          -1.54 -52.39
BM_Swap_SmallTrivialFunctor_SmallTrivialFunctor 2.93            1.40 -1.53 -52.13
std::vector<std::string>::operator=(const&)_(cheap_elements)/32 27.29           13.44 -13.85          -50.75
rng::find_last(forward_list<int>)_(bail_10%)/1048576 717899.62 366820.69     -351078.93          -48.90
BM_Copy_MemFuncPtr 1.14            0.60          -0.55 -47.96
rng::find_last(forward_list<int>)_(bail_90%)/1048576 677668.97       394148.17 -283520.80 -41.84
std::vector<std::string>::operator=(const&)_(cheap_elements)/1024 719.78          420.44 -299.34          -41.59
BM_ConstructAndDestroy_FuncPtr_Opaque 1.18 0.69          -0.49          -41.32
BM_PushHeap_float_Descending_1 0.70 0.41          -0.29 -40.96
std::flat_multimap<int,_int>::operator=(const&)_(into_cleared_Container)/8192 917.32          550.81        -366.50 -39.95
rng::move_backward(vector<int>)/262144 23288.26        14229.98 -9058.29 -38.90
std::flat_multimap<int,_int>::operator=(const&)_(into_populated_Container)/8192 834.35          512.16        -322.19 -38.62
BM_RangesPopHeap_pair<uint32,_uint32>_1 0.70            0.43 -0.26          -37.84
BM_RangesMakeHeap_uint64_Random_262144 1.64 1.03          -0.62 -37.61
std::flat_multimap<int,_int>::operator=(const&)_(into_partially_populated_Container)/8192 877.22          548.19        -329.03 -37.51
BM_ConstructAndDestroy_SmallTrivialFunctor_Opaque 0.69            0.44 -0.25          -35.84
std::search(deque<int>)_(no_match)/1024 420.60 274.49        -146.11          -34.74
BM_RangesMakeHeap_uint64_Random_16384 1.48            0.97          -0.51 -34.46
BM_MakeHeap_uint64_Random_262144 1.59            1.06 -0.54          -33.73
BM_Invoke_LargeTrivialFunctor 0.67 0.45          -0.23          -33.57
BM_Invoke_SmallTrivialFunctor 0.67 0.45          -0.23 -33.44
BM_MakeHeap_uint64_Random_16384 1.54            1.03 -0.52          -33.38
BM_RangesPushHeap_uint64_Ascending_1 0.70 0.47          -0.23 -32.98
SetIntersection_Front_Set_uint32_16384_16384 359161497.88    241585619.31 -117575878.57          -32.74
BM_RangesMakeHeap_uint64_Random_1024 1.54 1.04          -0.50          -32.43
rng::copy_n(vector<int>)/32768 3269.99         2234.01       -1035.98 -31.68
std::unordered_map<int,_int>::contains(key)_(existent)/0 0.01            0.01 -0.00          -31.52
SetIntersection_Interlaced_Vector_uint64_262144_256 40066146.21 27474909.57   -12591236.64 -31.43
BM_ConstructAndDestroy_MemPtr_Opaque 0.90            0.62 -0.28 -31.27
std::flat_multimap<int,_int>::contains(key)_(non-existent)/0 0.65            0.45 -0.20          -31.25
SetIntersection_Front_Set_uint32_262144_16384 361161254.49 248352975.08  -112808279.40 -31.23
BM_RangesPushHeap_tuple<uint32,_uint64,_uint32>_Random_1 0.70            0.48 -0.22          -31.03
```

Full results here: [comparison.txt](https://github.com/user-attachments/files/22752730/comparison.txt)

This should be pretty easy to reproduce locally as well. I will start filing issues as children of this one for individual investigations.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to