About frequently calling the function GetBoolArg to get parameters #24475

issue guoyl opened this issue on March 5, 2022
  1. guoyl commented at 8:17 AM on March 5, 2022: none

    In the /src/net.cpp, the functoin void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg) will be called frequently. The following code used inside function: ...... if (gArgs.GetBoolArg("-capturemessages", false)) { CaptureMessage(pnode->addr, msg.m_type, msg.data, /is_incoming=/false); } ...... My question is : the GetBoolArg can be called once when the class is initialized.

  2. MarcoFalke commented at 10:42 AM on March 5, 2022: member

    Yes, it can be called once. However, the impact should be minimal, as writing to disk takes more time than a map lookup.

  3. MarcoFalke closed this on Mar 7, 2022

  4. DrahtBot locked this on Mar 7, 2023
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me