Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Optimize NodeTable::nearestNodeEntries#5586

Merged
halfalicious merged 1 commit intomasterfrom
optimize-nearestnodes
May 6, 2019
Merged

Optimize NodeTable::nearestNodeEntries#5586
halfalicious merged 1 commit intomasterfrom
optimize-nearestnodes

Conversation

@gumb0
Copy link
Copy Markdown
Member

@gumb0 gumb0 commented Apr 30, 2019

Get rid of calculating hash many times in the loop.
Make distance function get hashes as input. Calculate hash for each NodeEntry only once and save it as a member of NodeEntry.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 30, 2019

Codecov Report

Merging #5586 into master will decrease coverage by 0.02%.
The diff coverage is 95.83%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5586      +/-   ##
=========================================
- Coverage   62.22%   62.2%   -0.03%     
=========================================
  Files         347     347              
  Lines       29136   29137       +1     
  Branches     3295    3295              
=========================================
- Hits        18131   18124       -7     
- Misses       9827    9832       +5     
- Partials     1178    1181       +3

@gumb0
Copy link
Copy Markdown
Member Author

gumb0 commented Apr 30, 2019

Needs rebase

@gumb0 gumb0 force-pushed the optimize-nearestnodes branch from 60aa856 to 82e3a59 Compare May 2, 2019 10:22
@gumb0
Copy link
Copy Markdown
Member Author

gumb0 commented May 2, 2019

Rebased.

@gumb0 gumb0 removed the in progress label May 2, 2019
@gumb0 gumb0 requested review from chfast and halfalicious May 2, 2019 10:37
@@ -112,7 +112,14 @@ class NodeTable : UDPSocketEvents
bool _enabled = true, bool _allowLocalDiscovery = false);

/// Returns distance based on xor metric two node ids. Used by NodeEntry and NodeTable.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Nit) Returns distance based on xor metric OF two node ids

@halfalicious halfalicious merged commit c19d891 into master May 6, 2019
@halfalicious halfalicious deleted the optimize-nearestnodes branch May 6, 2019 04:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants