Avoid recalculating vchKeyedNetGroup in eviction logic. #8088

pull pstratem wants to merge 1 commits into bitcoin:master from pstratem:2016-05-22-efficient-keyed-eviction changing 2 files +29 −34
  1. pstratem commented at 7:23 am on May 23, 2016: contributor

    Lazy calculate vchKeyedNetGroup in CNode::GetKeyedNetGroup.

    This is a (very small) performance improvement.

    Fix mentioned by gmaxwell in #8086

  2. pstratem renamed this:
    Avoid recalculating vchKeyedNetGroup in eviction logic.
    [WIP]Avoid recalculating vchKeyedNetGroup in eviction logic.
    on May 23, 2016
  3. gmaxwell commented at 7:37 am on May 23, 2016: contributor
    bleh. There really is no reason to do this lazily. It should eagerly generate it at connection time, saving a hashing operation that it’s going to perform anyways is not a good trade-off for having an extra heap allocation. Doubly so when the hash is changed to siphash.
  4. Avoid recalculating vchKeyedNetGroup in eviction logic.
    Lazy calculate vchKeyedNetGroup in CNode::GetKeyedNetGroup.
    ee57c208da
  5. pstratem force-pushed on May 23, 2016
  6. pstratem renamed this:
    [WIP]Avoid recalculating vchKeyedNetGroup in eviction logic.
    Avoid recalculating vchKeyedNetGroup in eviction logic.
    on May 23, 2016
  7. pstratem commented at 12:39 pm on May 23, 2016: contributor
    @gmaxwell i mean ok..
  8. jonasschnelli added the label P2P on May 23, 2016
  9. in src/net.h: in ee57c208da
    364@@ -363,6 +365,8 @@ class CNode
    365     CBloomFilter* pfilter;
    366     int nRefCount;
    367     NodeId id;
    368+
    369+    std::vector<unsigned char> vchKeyedNetGroup;
    


    sipa commented at 3:40 pm on May 24, 2016:
    Use a uint256, or even a uint64_t.

    gmaxwell commented at 6:08 pm on May 24, 2016:
    uint64_t please. The probability that two distinct net-groups share a 64-bit hash is negligible, and if it ever happens its harmless (and would have no effect at all unless it’s a collision with one of the four lowest ones that are in use).
  10. sipa commented at 3:51 pm on May 24, 2016: member
    Concept ACK. I think SHA256 is still overkill, but this is a clear improvement.
  11. sipa commented at 1:04 pm on May 26, 2016: member
    Included into #8086.
  12. gmaxwell commented at 7:03 pm on June 10, 2016: contributor
    This should be closed, was merged via 8086->8173.
  13. pstratem closed this on Jun 11, 2016

  14. MarcoFalke locked this on Sep 8, 2021

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: 2024-11-17 21:12 UTC

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