The `getaddressesbylabel` API spends a lot more time than the `getaddressesbyaccount` API.

I generated addresses by the `getnewaddress` API, then, I measured time that the `getaddressesby*` API spends. It seems the algorithm of the `getaddressesbylabel` API takes **O(N ^ 2)** time! The results of my survey are as follows.

### getaddressesbylabel

bitcoind v0.17.1 on Ubuntu 16.04 (AWS EC2 t3.large)

#### 11,001 addresses

```sh
time sudo /usr/local/bin/bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getaddressesbylabel ""
# (omitted)
real    0m1.230s # 1.2s
user    0m0.044s
sys 0m0.048s
```

#### 111,001 addresses

```sh
time sudo /usr/local/bin/bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getaddressesbylabel ""
# (omitted)
real    1m37.027s # 97.0s
user    0m0.408s
sys 0m0.544s
```

#### 211,001 addresses

```sh
time sudo /usr/local/bin/bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getaddressesbylabel ""
# (omitted)
real    6m3.727s # 363.7s
user    0m0.800s
sys 0m0.900s
```

### getaddressesbyaccount

bitcoind v0.16.3 on Ubuntu 16.04 (AWS EC2 t3.large)

#### 11,001 addresses

```sh
time sudo /usr/local/bin/bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getaddressesbyaccount ""
# (omitted)
real    0m0.500s # 0.5s
user    0m0.092s
sys 0m0.160s
```

#### 111,001 addresses

```sh
time sudo /usr/local/bin/bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getaddressesbyaccount ""
# (omitted)
real    0m1.361s # 1.4s
user    0m0.168s
sys 0m0.348s
```

#### 211,001 addresses

```sh
time sudo /usr/local/bin/bitcoin-cli -conf=/etc/bitcoin/bitcoin.conf getaddressesbyaccount ""
# (omitted)
real    0m2.220s # 2.2s
user    0m0.384s
sys 0m0.532s
```

if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance)
            strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired));
        throw JSONRPCError(RPC_WALLET_ERROR, strError);
    }
    CValidationState state;
    if (!pwallet->CommitTransaction(tx, std::move(mapValue), {} , reservekey, g_connman.get(), state)) {
        strError = strprintf("Error: The transaction was rejected! Reason given: %s", FormatStateMessage(state));
        throw JSONRPCError(RPC_WALLET_ERROR, strError);
    }
    return tx;
}
static UniValue sendtoaddress(const JSONRPCRequest& request)
{
    std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
    CWallet* const pwallet = wallet.get();
    if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
        return NullUniValue;
    }
    if (request.fHelp || request.params.size() < 2 || request.params.size() > 8)
        throw std::runtime_error(
            RPCHelpMan{"sendtoaddress",
                "\nSend an amount to a given address." +
                    HelpRequiringPassphrase(pwallet) + "\n",
                {
                    {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to send to."},
                    {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The amount in " + CURRENCY_UNIT + " to send. eg 0.1"},
                    {"comment", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A comment used to store what the transaction is for.\n"
            "                             This is not part of the transaction, just kept in your wallet."},
                    {"comment_to", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A comment to store the name of the person or organization\n"
            "                             to which you're sending the transaction. This is not part of the \n"