Commit 84eb0d4
[libc++] Optimize {set,map}::{lower,upper}_bound (#161366)
Apple M4:
```
Benchmark Baseline Candidate Difference % Difference
--------------------------------------------------------------------------------------------- ---------- ----------- ------------ --------------
std::map<int,_int>::lower_bound(key)_(existent)/0 0.01 0.01 -0.00 -25.78
std::map<int,_int>::lower_bound(key)_(existent)/1024 7.94 4.28 -3.66 -46.09
std::map<int,_int>::lower_bound(key)_(existent)/32 2.73 1.69 -1.03 -37.89
std::map<int,_int>::lower_bound(key)_(existent)/8192 11.63 5.52 -6.11 -52.55
std::map<int,_int>::lower_bound(key)_(non-existent)/0 0.28 0.28 -0.00 -1.35
std::map<int,_int>::lower_bound(key)_(non-existent)/1024 17.21 7.63 -9.58 -55.67
std::map<int,_int>::lower_bound(key)_(non-existent)/32 4.71 3.26 -1.45 -30.71
std::map<int,_int>::lower_bound(key)_(non-existent)/8192 26.82 10.58 -16.24 -60.55
std::map<int,_int>::upper_bound(key)_(existent)/0 0.01 0.01 0.00 20.62
std::map<int,_int>::upper_bound(key)_(existent)/1024 7.93 3.61 -4.32 -54.49
std::map<int,_int>::upper_bound(key)_(existent)/32 2.83 1.98 -0.85 -30.01
std::map<int,_int>::upper_bound(key)_(existent)/8192 11.69 5.72 -5.97 -51.06
std::map<int,_int>::upper_bound(key)_(non-existent)/0 0.28 0.28 -0.00 -1.36
std::map<int,_int>::upper_bound(key)_(non-existent)/1024 17.21 8.00 -9.21 -53.53
std::map<int,_int>::upper_bound(key)_(non-existent)/32 4.70 2.93 -1.78 -37.76
std::map<int,_int>::upper_bound(key)_(non-existent)/8192 26.54 11.18 -15.36 -57.89
std::map<std::string,_int>::lower_bound(key)_(existent)/0 0.04 0.04 -0.00 -3.26
std::map<std::string,_int>::lower_bound(key)_(existent)/1024 27.46 26.25 -1.22 -4.43
std::map<std::string,_int>::lower_bound(key)_(existent)/32 19.17 15.71 -3.46 -18.07
std::map<std::string,_int>::lower_bound(key)_(existent)/8192 35.33 35.03 -0.30 -0.84
std::map<std::string,_int>::lower_bound(key)_(non-existent)/0 0.27 0.27 -0.00 -1.45
std::map<std::string,_int>::lower_bound(key)_(non-existent)/1024 24.88 24.17 -0.70 -2.83
std::map<std::string,_int>::lower_bound(key)_(non-existent)/32 11.67 11.63 -0.04 -0.32
std::map<std::string,_int>::lower_bound(key)_(non-existent)/8192 31.81 32.33 0.52 1.64
std::map<std::string,_int>::upper_bound(key)_(existent)/0 0.04 0.04 -0.00 -2.22
std::map<std::string,_int>::upper_bound(key)_(existent)/1024 29.91 26.51 -3.40 -11.38
std::map<std::string,_int>::upper_bound(key)_(existent)/32 19.69 17.74 -1.95 -9.92
std::map<std::string,_int>::upper_bound(key)_(existent)/8192 32.55 35.24 2.69 8.25
std::map<std::string,_int>::upper_bound(key)_(non-existent)/0 0.27 0.27 -0.00 -1.74
std::map<std::string,_int>::upper_bound(key)_(non-existent)/1024 23.87 26.77 2.91 12.18
std::map<std::string,_int>::upper_bound(key)_(non-existent)/32 11.44 11.81 0.37 3.24
std::map<std::string,_int>::upper_bound(key)_(non-existent)/8192 33.02 32.59 -0.43 -1.29
std::set<int>::lower_bound(key)_(existent)/0 0.01 0.01 0.00 0.48
std::set<int>::lower_bound(key)_(existent)/1024 7.83 4.21 -3.62 -46.23
std::set<int>::lower_bound(key)_(existent)/32 2.74 1.68 -1.06 -38.81
std::set<int>::lower_bound(key)_(existent)/8192 22.75 11.12 -11.63 -51.12
std::set<int>::lower_bound(key)_(non-existent)/0 0.28 0.27 -0.01 -3.52
std::set<int>::lower_bound(key)_(non-existent)/1024 17.15 8.40 -8.75 -51.03
std::set<int>::lower_bound(key)_(non-existent)/32 4.63 2.50 -2.13 -46.03
std::set<int>::lower_bound(key)_(non-existent)/8192 28.88 11.05 -17.82 -61.72
std::set<int>::upper_bound(key)_(existent)/0 0.01 0.01 -0.00 -7.79
std::set<int>::upper_bound(key)_(existent)/1024 7.80 3.63 -4.16 -53.42
std::set<int>::upper_bound(key)_(existent)/32 2.81 1.90 -0.91 -32.44
std::set<int>::upper_bound(key)_(existent)/8192 21.93 11.35 -10.58 -48.26
std::set<int>::upper_bound(key)_(non-existent)/0 0.28 0.27 -0.01 -3.81
std::set<int>::upper_bound(key)_(non-existent)/1024 16.76 7.38 -9.38 -55.98
std::set<int>::upper_bound(key)_(non-existent)/32 4.58 3.10 -1.48 -32.31
std::set<int>::upper_bound(key)_(non-existent)/8192 26.95 10.70 -16.25 -60.29
std::set<std::string>::lower_bound(key)_(existent)/0 0.04 0.04 0.00 0.02
std::set<std::string>::lower_bound(key)_(existent)/1024 28.08 27.04 -1.04 -3.71
std::set<std::string>::lower_bound(key)_(existent)/32 17.53 16.94 -0.58 -3.34
std::set<std::string>::lower_bound(key)_(existent)/8192 32.79 33.28 0.49 1.49
std::set<std::string>::lower_bound(key)_(non-existent)/0 0.28 0.28 -0.00 -0.06
std::set<std::string>::lower_bound(key)_(non-existent)/1024 25.23 24.38 -0.85 -3.38
std::set<std::string>::lower_bound(key)_(non-existent)/32 11.45 11.68 0.24 2.07
std::set<std::string>::lower_bound(key)_(non-existent)/8192 32.30 36.80 4.50 13.95
std::set<std::string>::upper_bound(key)_(existent)/0 0.04 0.04 -0.00 -0.14
std::set<std::string>::upper_bound(key)_(existent)/1024 26.71 26.37 -0.34 -1.27
std::set<std::string>::upper_bound(key)_(existent)/32 20.07 19.06 -1.02 -5.06
std::set<std::string>::upper_bound(key)_(existent)/8192 36.69 35.50 -1.19 -3.25
std::set<std::string>::upper_bound(key)_(non-existent)/0 0.28 0.28 -0.00 -0.16
std::set<std::string>::upper_bound(key)_(non-existent)/1024 24.48 24.90 0.42 1.73
std::set<std::string>::upper_bound(key)_(non-existent)/32 11.68 11.77 0.09 0.77
std::set<std::string>::upper_bound(key)_(non-existent)/8192 33.16 34.12 0.96 2.89
```1 parent 9c87e7b commit 84eb0d4
3 files changed
+149
-56
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1166 | 1166 | | |
1167 | 1167 | | |
1168 | 1168 | | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1169 | 1196 | | |
1170 | | - | |
1171 | | - | |
| 1197 | + | |
| 1198 | + | |
1172 | 1199 | | |
| 1200 | + | |
1173 | 1201 | | |
1174 | | - | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
1175 | 1206 | | |
1176 | | - | |
1177 | | - | |
| 1207 | + | |
| 1208 | + | |
1178 | 1209 | | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
1179 | 1216 | | |
1180 | 1217 | | |
1181 | | - | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
1182 | 1225 | | |
1183 | | - | |
1184 | | - | |
| 1226 | + | |
| 1227 | + | |
1185 | 1228 | | |
| 1229 | + | |
1186 | 1230 | | |
1187 | | - | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
1188 | 1235 | | |
1189 | | - | |
1190 | | - | |
| 1236 | + | |
| 1237 | + | |
1191 | 1238 | | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
1192 | 1245 | | |
1193 | 1246 | | |
1194 | | - | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
1195 | 1250 | | |
1196 | 1251 | | |
1197 | 1252 | | |
| |||
2100 | 2155 | | |
2101 | 2156 | | |
2102 | 2157 | | |
2103 | | - | |
2104 | | - | |
| 2158 | + | |
| 2159 | + | |
2105 | 2160 | | |
2106 | 2161 | | |
2107 | 2162 | | |
2108 | 2163 | | |
2109 | 2164 | | |
2110 | 2165 | | |
2111 | | - | |
2112 | | - | |
| 2166 | + | |
| 2167 | + | |
2113 | 2168 | | |
2114 | 2169 | | |
2115 | 2170 | | |
| |||
2122 | 2177 | | |
2123 | 2178 | | |
2124 | 2179 | | |
2125 | | - | |
| 2180 | + | |
2126 | 2181 | | |
2127 | 2182 | | |
2128 | 2183 | | |
| |||
2136 | 2191 | | |
2137 | 2192 | | |
2138 | 2193 | | |
2139 | | - | |
2140 | | - | |
| 2194 | + | |
| 2195 | + | |
2141 | 2196 | | |
2142 | 2197 | | |
2143 | 2198 | | |
| |||
2150 | 2205 | | |
2151 | 2206 | | |
2152 | 2207 | | |
2153 | | - | |
| 2208 | + | |
2154 | 2209 | | |
2155 | 2210 | | |
2156 | 2211 | | |
| |||
2226 | 2281 | | |
2227 | 2282 | | |
2228 | 2283 | | |
2229 | | - | |
2230 | | - | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
2231 | 2287 | | |
2232 | 2288 | | |
2233 | 2289 | | |
| |||
2249 | 2305 | | |
2250 | 2306 | | |
2251 | 2307 | | |
2252 | | - | |
2253 | | - | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
2254 | 2311 | | |
2255 | 2312 | | |
2256 | 2313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1300 | 1300 | | |
1301 | 1301 | | |
1302 | 1302 | | |
1303 | | - | |
1304 | | - | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
1305 | 1311 | | |
1306 | 1312 | | |
1307 | 1313 | | |
1308 | 1314 | | |
1309 | 1315 | | |
1310 | | - | |
| 1316 | + | |
1311 | 1317 | | |
1312 | 1318 | | |
1313 | 1319 | | |
1314 | 1320 | | |
1315 | 1321 | | |
1316 | 1322 | | |
1317 | | - | |
| 1323 | + | |
1318 | 1324 | | |
1319 | 1325 | | |
1320 | 1326 | | |
1321 | | - | |
1322 | | - | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
1323 | 1333 | | |
1324 | 1334 | | |
1325 | 1335 | | |
1326 | 1336 | | |
1327 | 1337 | | |
1328 | | - | |
| 1338 | + | |
1329 | 1339 | | |
1330 | 1340 | | |
1331 | 1341 | | |
1332 | 1342 | | |
1333 | 1343 | | |
1334 | | - | |
| 1344 | + | |
1335 | 1345 | | |
1336 | 1346 | | |
1337 | 1347 | | |
| |||
1871 | 1881 | | |
1872 | 1882 | | |
1873 | 1883 | | |
1874 | | - | |
1875 | | - | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
1876 | 1890 | | |
1877 | 1891 | | |
1878 | 1892 | | |
1879 | | - | |
| 1893 | + | |
1880 | 1894 | | |
1881 | 1895 | | |
1882 | 1896 | | |
1883 | 1897 | | |
1884 | | - | |
| 1898 | + | |
1885 | 1899 | | |
1886 | 1900 | | |
1887 | 1901 | | |
1888 | | - | |
1889 | | - | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
1890 | 1908 | | |
1891 | 1909 | | |
1892 | 1910 | | |
1893 | | - | |
| 1911 | + | |
1894 | 1912 | | |
1895 | 1913 | | |
1896 | 1914 | | |
1897 | | - | |
| 1915 | + | |
1898 | 1916 | | |
1899 | 1917 | | |
1900 | 1918 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
849 | 849 | | |
850 | 850 | | |
851 | 851 | | |
852 | | - | |
853 | | - | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
854 | 860 | | |
855 | 861 | | |
856 | 862 | | |
857 | | - | |
| 863 | + | |
858 | 864 | | |
859 | 865 | | |
860 | 866 | | |
861 | 867 | | |
862 | | - | |
| 868 | + | |
863 | 869 | | |
864 | 870 | | |
865 | 871 | | |
866 | | - | |
867 | | - | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
868 | 878 | | |
869 | 879 | | |
870 | 880 | | |
871 | | - | |
| 881 | + | |
872 | 882 | | |
873 | 883 | | |
874 | 884 | | |
875 | | - | |
| 885 | + | |
876 | 886 | | |
877 | 887 | | |
878 | 888 | | |
| |||
1301 | 1311 | | |
1302 | 1312 | | |
1303 | 1313 | | |
1304 | | - | |
1305 | | - | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
1306 | 1320 | | |
1307 | 1321 | | |
1308 | 1322 | | |
1309 | | - | |
| 1323 | + | |
1310 | 1324 | | |
1311 | 1325 | | |
1312 | 1326 | | |
1313 | 1327 | | |
1314 | | - | |
| 1328 | + | |
1315 | 1329 | | |
1316 | 1330 | | |
1317 | 1331 | | |
1318 | | - | |
1319 | | - | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1320 | 1338 | | |
1321 | 1339 | | |
1322 | 1340 | | |
1323 | | - | |
| 1341 | + | |
1324 | 1342 | | |
1325 | 1343 | | |
1326 | 1344 | | |
1327 | | - | |
| 1345 | + | |
1328 | 1346 | | |
1329 | 1347 | | |
1330 | 1348 | | |
| |||
0 commit comments