Hmm, is there a reason why blockundo takes only 1.6ms in total end-to-end when spenttxouts takes 4.6ms in total end-to-end, where about 2.6ms happen on the server (https://github.com/bitcoin/bitcoin/pull/32540#discussion_r2109843001). So with spenttxouts, the client spends about 2ms with 18% CPU and with blockundo the client spends about .8ms with 58% CPU.
I would like to note that #32540 (review) was benchmarked using ApacheBench, but #32540 (review) was benchmarked a custom client tool (based on ureq) - so the latencies' delta is also affected by the HTTP client performance differences.
If I understand correctly, the client-side handling of spenttxouts response takes 2ms * 18% = 360us CPU time, which is indeed a bit better compared to client-side handling of blockundo response, which takes 0.8ms * 58% = 464us CPU time.
Also, most of the scripts during electrs indexing don't require complex decompression,since most of compressed ones are P2PKH and P2SH types (see the by_type histogram below):
$ time cargo run --release --bin blockundo
Finished `release` profile [optimized] target(s) in 0.02s
Running `target/release/blockundo`
[700000..701000) 1202[us/call] Stats { total: 5117052, value: 4220850331315943, by_type: [1545802, 2028814, 8, 5, 0, 0, 1542423] }
[701000..702000) 1248[us/call] Stats { total: 5016564, value: 3238540334293590, by_type: [1485990, 2015971, 4, 7, 0, 0, 1514592] }
[702000..703000) 1364[us/call] Stats { total: 5303401, value: 2664566072512831, by_type: [1586091, 2071826, 2, 4, 0, 0, 1645478] }
[703000..704000) 1378[us/call] Stats { total: 5666124, value: 2400056525309041, by_type: [1671073, 2216971, 2, 10, 0, 1, 1778067] }
[704000..705000) 1373[us/call] Stats { total: 5835815, value: 2765124924840842, by_type: [1607472, 2347087, 4, 17, 2, 1, 1881232] }
[705000..706000) 1283[us/call] Stats { total: 5571989, value: 2720571523603325, by_type: [1438779, 2236071, 4, 8, 2, 0, 1897125] }
[706000..707000) 1263[us/call] Stats { total: 5371702, value: 2113610858419429, by_type: [1416760, 2128942, 2, 4, 0, 1, 1825993] }
[707000..708000) 1318[us/call] Stats { total: 5559416, value: 2439623089965085, by_type: [1492894, 2172092, 4, 10, 0, 2, 1894414] }
[708000..709000) 1330[us/call] Stats { total: 5611331, value: 2946515191901043, by_type: [1406453, 2246277, 4, 11, 0, 1, 1958585] }
[709000..710000) 1317[us/call] Stats { total: 5589581, value: 3176856863850345, by_type: [1289761, 2315330, 4, 12, 0, 0, 1984474] }
real 0m14.856s
user 0m8.244s
sys 0m1.835s
<details>
<summary> Full chain indexing stats </summary>
[@10000](/bitcoin-bitcoin/contributor/10000/) { count: 625, count_by_type: [6, 0, 0, 0, 319, 300, 0] }
[@20000](/bitcoin-bitcoin/contributor/20000/) { count: 532, count_by_type: [4, 0, 0, 0, 245, 283, 0] }
[@30000](/bitcoin-bitcoin/contributor/30000/) { count: 1712, count_by_type: [40, 0, 0, 0, 876, 796, 0] }
[@40000](/bitcoin-bitcoin/contributor/40000/) { count: 2208, count_by_type: [55, 0, 0, 0, 1093, 1060, 0] }
[@50000](/bitcoin-bitcoin/contributor/50000/) { count: 4372, count_by_type: [191, 0, 0, 0, 2103, 2078, 0] }
[@60000](/bitcoin-bitcoin/contributor/60000/) { count: 13608, count_by_type: [6408, 0, 0, 0, 3569, 3631, 0] }
[@70000](/bitcoin-bitcoin/contributor/70000/) { count: 22269, count_by_type: [15653, 0, 0, 0, 3386, 3230, 0] }
[@80000](/bitcoin-bitcoin/contributor/80000/) { count: 30428, count_by_type: [22242, 0, 0, 0, 4093, 4093, 0] }
[@90000](/bitcoin-bitcoin/contributor/90000/) { count: 30269, count_by_type: [20322, 0, 0, 0, 5050, 4897, 0] }
[@100000](/bitcoin-bitcoin/contributor/100000/) { count: 86340, count_by_type: [77381, 0, 0, 0, 4443, 4516, 0] }
[@110000](/bitcoin-bitcoin/contributor/110000/) { count: 94901, count_by_type: [85488, 0, 0, 0, 4778, 4635, 0] }
[@120000](/bitcoin-bitcoin/contributor/120000/) { count: 216635, count_by_type: [206244, 0, 0, 0, 5256, 5135, 0] }
[@130000](/bitcoin-bitcoin/contributor/130000/) { count: 467230, count_by_type: [453412, 0, 0, 0, 6869, 6948, 1] }
[@140000](/bitcoin-bitcoin/contributor/140000/) { count: 976449, count_by_type: [962537, 0, 0, 0, 6911, 7000, 1] }
[@150000](/bitcoin-bitcoin/contributor/150000/) { count: 920621, count_by_type: [909053, 0, 0, 0, 5875, 5693, 0] }
[@160000](/bitcoin-bitcoin/contributor/160000/) { count: 770334, count_by_type: [702686, 0, 0, 0, 5200, 62447, 1] }
[@170000](/bitcoin-bitcoin/contributor/170000/) { count: 950547, count_by_type: [899533, 0, 95, 88, 3929, 46879, 23] }
[@180000](/bitcoin-bitcoin/contributor/180000/) { count: 1198258, count_by_type: [1095960, 33, 359, 348, 3112, 98441, 5] }
[@190000](/bitcoin-bitcoin/contributor/190000/) { count: 4185359, count_by_type: [4088500, 31, 316, 321, 2372, 93819, 0] }
[@200000](/bitcoin-bitcoin/contributor/200000/) { count: 4339502, count_by_type: [4233624, 12, 373, 341, 2053, 103099, 0] }
[@210000](/bitcoin-bitcoin/contributor/210000/) { count: 4441565, count_by_type: [4331440, 34, 560, 582, 1681, 107267, 1] }
[@220000](/bitcoin-bitcoin/contributor/220000/) { count: 6371400, count_by_type: [6311580, 58, 620, 588, 1058, 56422, 1074] }
[@230000](/bitcoin-bitcoin/contributor/230000/) { count: 7385694, count_by_type: [7337631, 26, 241, 254, 868, 45860, 814] }
[@240000](/bitcoin-bitcoin/contributor/240000/) { count: 7630690, count_by_type: [7570439, 71, 71, 58, 442, 57704, 1905] }
[@250000](/bitcoin-bitcoin/contributor/250000/) { count: 5437882, count_by_type: [5409041, 31, 146, 150, 413, 27769, 332] }
[@260000](/bitcoin-bitcoin/contributor/260000/) { count: 6433106, count_by_type: [6421397, 148, 1492, 1745, 60, 8245, 19] }
[@270000](/bitcoin-bitcoin/contributor/270000/) { count: 6655459, count_by_type: [6648335, 169, 742, 770, 239, 5155, 49] }
[@280000](/bitcoin-bitcoin/contributor/280000/) { count: 9090816, count_by_type: [9084292, 802, 922, 940, 219, 3609, 32] }
[@290000](/bitcoin-bitcoin/contributor/290000/) { count: 9979571, count_by_type: [9973322, 2192, 484, 559, 99, 1173, 1742] }
[@300000](/bitcoin-bitcoin/contributor/300000/) { count: 10654043, count_by_type: [10641469, 5391, 214, 182, 74, 359, 6354] }
[@310000](/bitcoin-bitcoin/contributor/310000/) { count: 10963860, count_by_type: [10952275, 8245, 153, 75, 59, 193, 2860] }
[@320000](/bitcoin-bitcoin/contributor/320000/) { count: 11873101, count_by_type: [11854048, 14195, 106, 118, 21, 134, 4479] }
[@330000](/bitcoin-bitcoin/contributor/330000/) { count: 14230246, count_by_type: [14181599, 42163, 55, 59, 39, 44, 6287] }
[@340000](/bitcoin-bitcoin/contributor/340000/) { count: 17051600, count_by_type: [16915582, 128618, 49, 65, 12, 19, 7255] }
[@350000](/bitcoin-bitcoin/contributor/350000/) { count: 18844424, count_by_type: [18555035, 286021, 61, 84, 12, 17, 3194] }
[@360000](/bitcoin-bitcoin/contributor/360000/) { count: 20168255, count_by_type: [19716328, 448173, 101, 79, 19, 16, 3539] }
[@370000](/bitcoin-bitcoin/contributor/370000/) { count: 25484802, count_by_type: [24460043, 799300, 1555, 326, 18, 21, 223539] }
[@380000](/bitcoin-bitcoin/contributor/380000/) { count: 26632610, count_by_type: [25420272, 1132582, 990, 78308, 16, 16, 426] }
[@390000](/bitcoin-bitcoin/contributor/390000/) { count: 29920038, count_by_type: [28007502, 1911310, 165, 399, 6, 10, 646] }
[@400000](/bitcoin-bitcoin/contributor/400000/) { count: 33174951, count_by_type: [29994572, 3179220, 335, 546, 9, 8, 261] }
[@410000](/bitcoin-bitcoin/contributor/410000/) { count: 35316148, count_by_type: [30938732, 4376693, 235, 348, 15, 17, 108] }
[@420000](/bitcoin-bitcoin/contributor/420000/) { count: 36303753, count_by_type: [28968248, 7334817, 177, 235, 53, 33, 190] }
[@430000](/bitcoin-bitcoin/contributor/430000/) { count: 35653677, count_by_type: [27595998, 8055172, 210, 364, 80, 78, 1775] }
[@440000](/bitcoin-bitcoin/contributor/440000/) { count: 38766615, count_by_type: [32663128, 6092786, 6114, 4528, 4, 5, 50] }
[@450000](/bitcoin-bitcoin/contributor/450000/) { count: 40971286, count_by_type: [33990735, 6940850, 22796, 16756, 59, 67, 23] }
[@460000](/bitcoin-bitcoin/contributor/460000/) { count: 43714996, count_by_type: [34797370, 8769454, 78945, 68732, 29, 27, 439] }
[@470000](/bitcoin-bitcoin/contributor/470000/) { count: 44793610, count_by_type: [36861662, 7893476, 17469, 13333, 125, 113, 7432] }
[@480000](/bitcoin-bitcoin/contributor/480000/) { count: 43067356, count_by_type: [35001816, 8022393, 23940, 19081, 50, 68, 8] }
[@490000](/bitcoin-bitcoin/contributor/490000/) { count: 41648952, count_by_type: [34331046, 7243408, 33811, 23866, 126, 103, 16592] }
[@500000](/bitcoin-bitcoin/contributor/500000/) { count: 48152093, count_by_type: [39194969, 8699336, 45380, 21680, 126, 638, 189964] }
[@510000](/bitcoin-bitcoin/contributor/510000/) { count: 51326853, count_by_type: [41648279, 9514253, 29313, 19764, 56, 56, 115132] }
[@520000](/bitcoin-bitcoin/contributor/520000/) { count: 38282217, count_by_type: [26528958, 9846227, 55475, 37867, 8, 830, 1812852] }
[@530000](/bitcoin-bitcoin/contributor/530000/) { count: 35641361, count_by_type: [21935229, 11658151, 73825, 63940, 5, 4, 1910207] }
[@540000](/bitcoin-bitcoin/contributor/540000/) { count: 37925935, count_by_type: [22191957, 13021405, 59315, 69483, 3, 1, 2583771] }
[@550000](/bitcoin-bitcoin/contributor/550000/) { count: 41406281, count_by_type: [22222938, 16756471, 65310, 62101, 0, 1, 2299460] }
[@560000](/bitcoin-bitcoin/contributor/560000/) { count: 43870253, count_by_type: [22823642, 18214259, 70668, 63685, 13, 17, 2697969] }
[@570000](/bitcoin-bitcoin/contributor/570000/) { count: 45559248, count_by_type: [23905511, 18634825, 65411, 59658, 7, 0, 2893836] }
[@580000](/bitcoin-bitcoin/contributor/580000/) { count: 53162820, count_by_type: [28191011, 21458817, 120620, 62791, 2, 3, 3329576] }
[@590000](/bitcoin-bitcoin/contributor/590000/) { count: 49851027, count_by_type: [25669849, 20537560, 87097, 68658, 20, 18, 3487825] }
[@600000](/bitcoin-bitcoin/contributor/600000/) { count: 45488260, count_by_type: [21660173, 17924275, 70819, 76051, 1, 3, 5756938] }
[@610000](/bitcoin-bitcoin/contributor/610000/) { count: 47894909, count_by_type: [22678756, 18364758, 69839, 72874, 13, 20, 6708649] }
[@620000](/bitcoin-bitcoin/contributor/620000/) { count: 46658506, count_by_type: [20975983, 18233797, 66047, 69796, 0, 1, 7312882] }
[@630000](/bitcoin-bitcoin/contributor/630000/) { count: 51374869, count_by_type: [24060911, 22276161, 69099, 76358, 12, 13, 4892315] }
[@640000](/bitcoin-bitcoin/contributor/640000/) { count: 55236113, count_by_type: [25829996, 24292211, 77550, 63710, 4, 5, 4972637] }
[@650000](/bitcoin-bitcoin/contributor/650000/) { count: 58526986, count_by_type: [27012329, 25968726, 70162, 42038, 1, 1, 5433729] }
[@660000](/bitcoin-bitcoin/contributor/660000/) { count: 58860657, count_by_type: [27378085, 25013577, 44432, 27502, 31, 41, 6396989] }
[@670000](/bitcoin-bitcoin/contributor/670000/) { count: 61278503, count_by_type: [28702102, 25080930, 42787, 23058, 50, 52, 7429524] }
[@680000](/bitcoin-bitcoin/contributor/680000/) { count: 61777564, count_by_type: [27253460, 26312639, 44094, 23632, 28, 30, 8143681] }
[@690000](/bitcoin-bitcoin/contributor/690000/) { count: 62519812, count_by_type: [25375197, 26596005, 11322, 4831, 13, 13, 10532431] }
[@700000](/bitcoin-bitcoin/contributor/700000/) { count: 48081507, count_by_type: [15082138, 19654137, 68, 57, 0, 2, 13345105] }
[@710000](/bitcoin-bitcoin/contributor/710000/) { count: 54343089, count_by_type: [15047415, 21643297, 49, 79, 27, 25, 17652197] }
[@720000](/bitcoin-bitcoin/contributor/720000/) { count: 54058927, count_by_type: [12764783, 22038270, 31, 165, 1, 3, 19255674] }
[@730000](/bitcoin-bitcoin/contributor/730000/) { count: 55869021, count_by_type: [13969490, 21107581, 121, 65, 4, 2, 20791758] }
[@740000](/bitcoin-bitcoin/contributor/740000/) { count: 56314981, count_by_type: [13982223, 19821462, 13, 423, 3, 4, 22510853] }
[@750000](/bitcoin-bitcoin/contributor/750000/) { count: 56873212, count_by_type: [13431311, 19640397, 16, 705, 4, 4, 23800775] }
[@760000](/bitcoin-bitcoin/contributor/760000/) { count: 54458039, count_by_type: [12599682, 17740021, 61, 32, 2, 1, 24118240] }
[@770000](/bitcoin-bitcoin/contributor/770000/) { count: 60185194, count_by_type: [15003214, 18161157, 109, 40, 17, 11, 27020646] }
[@780000](/bitcoin-bitcoin/contributor/780000/) { count: 56773118, count_by_type: [12743378, 15004250, 12, 55, 0, 3, 29025420] }
[@790000](/bitcoin-bitcoin/contributor/790000/) { count: 61986604, count_by_type: [11754470, 13425167, 5, 35, 1, 2, 36806924] }
[@800000](/bitcoin-bitcoin/contributor/800000/) { count: 66687770, count_by_type: [11366185, 13651998, 817, 1010, 2, 4, 41667754] }
[@810000](/bitcoin-bitcoin/contributor/810000/) { count: 68412707, count_by_type: [11444358, 11516461, 7, 18, 0, 1, 45451862] }
[@820000](/bitcoin-bitcoin/contributor/820000/) { count: 70786202, count_by_type: [8420325, 10293361, 269, 21, 10, 12, 52072204] }
[@830000](/bitcoin-bitcoin/contributor/830000/) { count: 67585727, count_by_type: [8215289, 8912455, 0, 0, 2, 1, 50457980] }
[@840000](/bitcoin-bitcoin/contributor/840000/) { count: 67915846, count_by_type: [7825901, 12450054, 15, 63, 51, 57, 47639705] }
[@850000](/bitcoin-bitcoin/contributor/850000/) { count: 74258694, count_by_type: [5661373, 9702626, 3, 6, 27, 18, 58894641] }
[@860000](/bitcoin-bitcoin/contributor/860000/) { count: 77988536, count_by_type: [7161911, 9020000, 8, 2, 0, 0, 61806615] }
[@870000](/bitcoin-bitcoin/contributor/870000/) { count: 78477781, count_by_type: [6867005, 8178130, 16, 13, 5, 5, 63432607] }
[@880000](/bitcoin-bitcoin/contributor/880000/) { count: 75299928, count_by_type: [8618571, 9341597, 24, 9, 22, 20, 57339685] }
[@890000](/bitcoin-bitcoin/contributor/890000/) { count: 80929642, count_by_type: [9942192, 6562388, 14, 11, 1, 1, 64425035] }
[@900000](/bitcoin-bitcoin/contributor/900000/) { count: 71287987, count_by_type: [10087225, 5561436, 16, 16, 1, 1, 55639292] }
</details>
Personally I'd just go with spenttxouts, but no strong opinion.
Sounds good, thanks! If there are no objections, I'll drop https://github.com/bitcoin/bitcoin/commit/62e68bd46726dc17b657c4c334b06351fc761868 from this PR.