Beldex-Coin / beldex

Beldex: the secure, private, untraceable cryptocurrency
https://beldex.io
Other
27 stars 21 forks source link

Wallet CLI performance issue #71

Closed codeman-crypto closed 2 years ago

codeman-crypto commented 2 years ago

The wallet CLI is taking too much time to load a wallet. This issue happens only for the wallet which has lakhs of transactions in it.

Note: need to work on simplewallet.cpp

Alexsanchez06 commented 2 years ago

I will look into this issue.

Alexsanchez06 commented 2 years ago

while checking the wallet-cli. I seen many logs in the node_rpc_proxy.cpp file

bool NodeRPCProxy::get_height(uint64_t &height) const { LOG_PRINT_L0("NodeRPCProxy::get_height"); auto now = std::chrono::steady_clock::now(); if (now >= m_height_time + 30s) // re-cache every 30 seconds if (!get_info()) return false; LOG_PRINT_L0("NodeRPCProxy::get_height:" << m_height); height = m_height; return true; }.

std::optional<uint8_t> NodeRPCProxy::get_hardfork_version() const { LOG_PRINT_L0("get_hardfork_version"); if (m_offline) return std::nullopt; LOG_PRINT_L0("invoke HARD_FORK_INFO"); auto now = std::chrono::steady_clock::now();

here the LOG_PRINT_L0 may slow down the wallet while refreshing the wallet. so I am looking into it.

sanada08 commented 2 years ago

Has some LOG_PRINT_L0 in noderpcproxy::get_info


{
  if (m_offline) return false;
  LOG_PRINT_L0("get_info");
  auto now = std::chrono::steady_clock::now();
  if (now >= m_get_info_time + 30s) // re-cache every 30 seconds
  {
    try {
      auto resp_t = invoke_json_rpc<rpc::GET_INFO>({});
      m_height = resp_t.height;
      LOG_PRINT_L0("GET_INFO success" << m_height);
      m_target_height = resp_t.target_height;
      m_block_weight_limit = resp_t.block_weight_limit ? resp_t.block_weight_limit : resp_t.block_size_limit;
      m_immutable_height = resp_t.immutable_height;
      m_get_info_time = now;
      m_height_time = now;
    } catch (...) {
        LOG_PRINT_L0("GET_INFO failed");
        return false; }
  }
  return true;
}```
Could you try to converting the LO to L3. Log level helpful.
codeman-crypto commented 2 years ago

@Alexsanchez06 What is the time metrics before and after removing of L0 logs..

Alexsanchez06 commented 2 years ago

when I tested it takes up to 90 - 120 seconds to load a wallet. After the log removal, the wallet performance is much better it takes only 2-3 seconds.

Alexsanchez06 commented 2 years ago

when using the LOG_PRINT_L3 it slows the wallet when running in log level 3 mode. so I think the better solution will be to remove the unnecessary logs.

Alexsanchez06 commented 2 years ago

72 pull request for wallet performance

codeman-crypto commented 2 years ago

@Alexsanchez06 Send me your BDX wallet address

Alexsanchez06 commented 2 years ago

bxd193yhdgtiLgLKZcxsEcaSTmgggSzt7gk4GRW8kRicKxLK5jQwaHsFYFXH9uPvzg53DXCnp4L9sdXYsunT8RKb2Sf4QgRaE
this is my beldex wallet @codeman-crypto

codeman-crypto commented 2 years ago

@Alexsanchez06 1000 BDX has been transferred to your wallet for this contribution.

https://explorer.beldex.io/tx/ffb2190d9c0849835c5a025ba6c22b807bde5809fbce4a2be27fe2df646d81d3

Alexsanchez06 commented 2 years ago

I got my contribution reward @codeman-crypto