`getblock` is slow on verbosity, it's happened because `LOCK(cs_main)` applied for whole function including JSON generation
https://github.com/bitcoin/bitcoin/blob/ef70f9b52b851c7997a9f1a0834714e3eebc1fd8/src/rpc/blockchain.cpp#L810

I added few lines which print spent time:
```cpp
    LOCK(cs_main);
    auto t1 = std::chrono::high_resolution_clock::now();
...
    auto t2 = std::chrono::high_resolution_clock::now();
    auto ret = blockToJSON(block, pblockindex, verbosity >= 2);
    auto t3 = std::chrono::high_resolution_clock::now();
    std::cout << "blockToJSON " << pblockindex->nHeight << ": " << std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1).count() << " " << std::chrono::duration_cast<std::chrono::microseconds>(t3 - t1).count() << std::endl;
    return ret;
```

and numbers looks like:
```
blockToJSON 570019: 14727 201870
blockToJSON 570022: 16049 225224
blockToJSON 570021: 33776 217398
blockToJSON 570020: 21754 191669
blockToJSON 570023: 30949 236941
blockToJSON 570025: 23346 223673
blockToJSON 570024: 18732 203002
blockToJSON 570026: 17467 216213
blockToJSON 570027: 16658 217395
blockToJSON 570028: 19015 219183
```

i.e. everything before JSON generation takes 15-30ms, while JSON takes minimum 190ms and lock `cs_main` for all this time. As result it's possible extract only ~5 blocks per second.

Looking on the code I think it's possible copy data from `CBlockIndex` to extra structure, so in this case `cs_main` can be unlocked right after `GetBlockChecked`.
https://github.com/bitcoin/bitcoin/blob/ef70f9b52b851c7997a9f1a0834714e3eebc1fd8/src/rpc/blockchain.cpp#L828
As result `getblock` in verbosity mode should be much faster (in case if `-rpcthreads` will be adjusted too).

Does this make sense?
{
    const RPCHelpMan help{"getblockstats",
                "\nCompute per block statistics for a given window. All amounts are in satoshis.\n"
                "It won't work for some heights with pruning.\n"
                "It won't work without -txindex for utxo_size_inc, *fee or *feerate stats.\n",
                {
                    {"hash_or_height", RPCArg::Type::NUM, RPCArg::Optional::NO, "The block hash or height of the target block", "", {"", "string or numeric"}},
                    {"stats", RPCArg::Type::ARR,  "all values", "Values to plot (see result below)",
                        {
                            {"height", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Selected statistic"},
                            {"time", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Selected statistic"},
                        },
                        "stats"},
                },
                RPCResult{
            "{                           (json object)\n"
            "  \"avgfee\": xxxxx,          (numeric) Average fee in the block\n"
            "  \"avgfeerate\": xxxxx,      (numeric) Average feerate (in satoshis per virtual byte)\n"
            "  \"avgtxsize\": xxxxx,       (numeric) Average transaction size\n"
            "  \"blockhash\": xxxxx,       (string) The block hash (to check for potential reorgs)\n"
            "  \"feerate_percentiles\": [  (array of numeric) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte)\n"
            "      \"10th_percentile_feerate\",      (numeric) The 10th percentile feerate\n"
            "      \"25th_percentile_feerate\",      (numeric) The 25th percentile feerate\n"
            "      \"50th_percentile_feerate\",      (numeric) The 50th percentile feerate\n"
            "      \"75th_percentile_feerate\",      (numeric) The 75th percentile feerate\n"
            "      \"90th_percentile_feerate\",      (numeric) The 90th percentile feerate\n"
            "  ],\n"
            "  \"height\": xxxxx,          (numeric) The height of the block\n"
            "  \"ins\": xxxxx,             (numeric) The number of inputs (excluding coinbase)\n"