Performing the following (note the range of 10,000):

`importmulti '[{"desc": "sh(wpkh([aeee1e6a/49h/1h/0h]tpubDC5bVdaveQYxGFztMShFAjU637kKjrs9FD8ne1oHR7z8tLeQJExsaxWRVeSpcCcYMdp5ecf2LQhuVaeYFZ7YEpvWTJr4nDGUJrmuvLuTSsp/1/*))", "keypool": true, "timestamp": "now", "watchonly": true, "internal": true, "range": {"end": 1000}}]' '{"rescan": false}'`

takes many minutes. @achow101 reports a similar import taking 6 minutes on his machine.
}
    
    if (mapKeyFirstBlock.empty())
        return;
    
    for (const auto& entry : mapWallet) {
        
        const CWalletTx &wtx = entry.second;
        if (Optional<int> height = locked_chain.getBlockHeight(wtx.hashBlock)) {
            
            for (const CTxOut &txout : wtx.tx->vout) {
                
                for (const auto &keyid : GetAffectedKeys(txout.scriptPubKey, *this)) {
                    
                    std::map<CKeyID, int>::iterator rit = mapKeyFirstBlock.find(keyid);
                    if (rit != mapKeyFirstBlock.end() && *height < rit->second)
                        rit->second = *height;
                }
            }
        }
    }
    
    for (const auto& entry : mapKeyFirstBlock)
        mapKeyBirth[entry.first] = locked_chain.getBlockTime(entry.second) - TIMESTAMP_WINDOW; 
}
/**
 * Compute smart timestamp for a transaction being added to the wallet.
 *
 * Logic:
 * - If sending a transaction, assign its timestamp to the current time.