New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up getchaintips. #7827

Merged
merged 1 commit into from Apr 19, 2016

Conversation

Projects
None yet
5 participants
@mrbandrews
Contributor

mrbandrews commented Apr 6, 2016

Fixes/addresses issue #5070.
Previous code made two passes through mapBlockIndex, inserted each block into a new set and then erased all but the chain tips - so hundreds of 1000's of inserts/erases.
This code makes one pass and only tests orphan blocks for being a chain tip.
Speedup on my machine against mainnet about 20x.
It passes the getchaintips.py Python test.

@instagibbs

This comment has been minimized.

Show comment
Hide comment
@instagibbs

instagibbs Apr 6, 2016

Member

utACK ac5a245cad5960b1867f586dd32e658b38d1d7f1

Member

instagibbs commented Apr 6, 2016

utACK ac5a245cad5960b1867f586dd32e658b38d1d7f1

@instagibbs

This comment has been minimized.

Show comment
Hide comment
@instagibbs

instagibbs Apr 6, 2016

Member

you might want to properly link #5070

Member

instagibbs commented Apr 6, 2016

you might want to properly link #5070

@sipa

This comment has been minimized.

Show comment
Hide comment
@sipa

sipa Apr 11, 2016

Member

utACK ac5a245

Member

sipa commented Apr 11, 2016

utACK ac5a245

@theuni

This comment has been minimized.

Show comment
Hide comment
@theuni

theuni Apr 12, 2016

Member

utACK ac5a245 .

You could also use setPrevs.erase(*it) == 0, to reduce the search range as you go. Probably not significant though.

Member

theuni commented Apr 12, 2016

utACK ac5a245 .

You could also use setPrevs.erase(*it) == 0, to reduce the search range as you go. Probably not significant though.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Apr 15, 2016

Member

@mrbandrews are you planning to add @theuni's suggestion? If so, I'll wait for that, if not, this can be merged.

Member

laanwj commented Apr 15, 2016

@mrbandrews are you planning to add @theuni's suggestion? If so, I'll wait for that, if not, this can be merged.

@mrbandrews

This comment has been minimized.

Show comment
Hide comment
@mrbandrews

mrbandrews Apr 15, 2016

Contributor

Yes I will make that edit but can't do so right now, will do by Monday.

Contributor

mrbandrews commented Apr 15, 2016

Yes I will make that edit but can't do so right now, will do by Monday.

@mrbandrews

This comment has been minimized.

Show comment
Hide comment
@mrbandrews

mrbandrews Apr 18, 2016

Contributor

Force-pushed that edit.

Contributor

mrbandrews commented Apr 18, 2016

Force-pushed that edit.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Apr 19, 2016

Member

tACK 87049e8 (tested that getchaintips returns the same before and after this patch)

Member

laanwj commented Apr 19, 2016

tACK 87049e8 (tested that getchaintips returns the same before and after this patch)

@laanwj laanwj merged commit 87049e8 into bitcoin:master Apr 19, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Apr 19, 2016

Merge #7827: Speed up getchaintips.
87049e8 Speed up getchaintips. (mrbandrews)

@dagurval dagurval referenced this pull request Nov 10, 2016

Merged

Speed up getchaintips. #169

codablock added a commit to codablock/dash that referenced this pull request Sep 16, 2017

Merge bitcoin#7827: Speed up getchaintips.
87049e8 Speed up getchaintips. (mrbandrews)

codablock added a commit to codablock/dash that referenced this pull request Sep 19, 2017

Merge bitcoin#7827: Speed up getchaintips.
87049e8 Speed up getchaintips. (mrbandrews)

codablock added a commit to codablock/dash that referenced this pull request Dec 20, 2017

Merge bitcoin#7827: Speed up getchaintips.
87049e8 Speed up getchaintips. (mrbandrews)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment