Avoid recalculating vchKeyedNetGroup in eviction logic.#8088
Avoid recalculating vchKeyedNetGroup in eviction logic.#8088pstratem wants to merge 1 commit intobitcoin:masterfrom
Conversation
|
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. |
Lazy calculate vchKeyedNetGroup in CNode::GetKeyedNetGroup.
66ed14d to
ee57c20
Compare
|
@gmaxwell i mean ok.. |
| int nRefCount; | ||
| NodeId id; | ||
|
|
||
| std::vector<unsigned char> vchKeyedNetGroup; |
There was a problem hiding this comment.
Use a uint256, or even a uint64_t.
There was a problem hiding this comment.
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).
|
Concept ACK. I think SHA256 is still overkill, but this is a clear improvement. |
|
Included into #8086. |
|
This should be closed, was merged via 8086->8173. |
Lazy calculate vchKeyedNetGroup in CNode::GetKeyedNetGroup.
This is a (very small) performance improvement.
Fix mentioned by gmaxwell in #8086