Skip to content
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

[Main] Write to the zerocoinDB in batches #636

Merged
merged 1 commit into from Jun 28, 2018

Conversation

Projects
None yet
3 participants
@Fuzzbawls
Copy link
Collaborator

Fuzzbawls commented Jun 12, 2018

instead of using a separate write operation for each and every bit of
data that needs to be flushed to disk, utilize leveldb's batch writing
capability.

The primary area of improvement this offers is when reindexing the zerocoinDB (-reindexzerocoin), which went from needing multiple hours on my system to mere minutes.

Secondary improvement area is in ConnectBlock() when multiple zerocoin transactions are involved.

[Main] Write to the zerocoinDB in batches
instead of using a separate write operation for each and every bit of
data that needs to be flushed to disk, utilize leveldb's batch writing
capability.
@Fuzzbawls

This comment has been minimized.

Copy link
Collaborator Author

Fuzzbawls commented Jun 13, 2018

thinking about this further...I could probably add a guard in ConnectBlock() that only calls the WriteBatch() function if the vSpends/vMints vectors have a size greater than zero...just to save a couple cycles in processing.

@Warrows

This comment has been minimized.

Copy link
Collaborator

Warrows commented Jun 19, 2018

Are you going to add this guard, or is the PR ready for test and review?

@Fuzzbawls

This comment has been minimized.

Copy link
Collaborator Author

Fuzzbawls commented Jun 19, 2018

@Warrows can be tested as-is. The internal batch write functions already don't do anything except a LogPrint() if the supplied vector has a size of zero.

@Warrows
Copy link
Collaborator

Warrows left a comment

ACK cd672cd. I can confirm the vast performance improvement on reindex.

@Mrs-X

Mrs-X approved these changes Jun 28, 2018

Copy link
Collaborator

Mrs-X left a comment

ACK (and yes, it's indeed faster ;-) ) and merging...

@Mrs-X Mrs-X merged commit cd672cd into PIVX-Project:master Jun 28, 2018

1 check passed

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

Mrs-X added a commit that referenced this pull request Jun 28, 2018

Merge #636: [Main] Write to the zerocoinDB in batches
cd672cd [Main] Write to the zerocoinDB in batches (Fuzzbawls)

Tree-SHA512: 031d41bf5d09b2f3636e191e0de5fbf8062cd967f76a25fe2705dceaf4e9a65875c394af5fb6e2ad08739a4acd3fa7945eff4594a11040e5aa9cf2b93ca04cd8

@wafflebot wafflebot bot removed the review label Jun 28, 2018

@Fuzzbawls Fuzzbawls added this to the 3.1.1 milestone Jul 5, 2018

Fuzzbawls added a commit to Fuzzbawls/PIVX that referenced this pull request Jul 6, 2018

[Main] Write to the zerocoinDB in batches
instead of using a separate write operation for each and every bit of
data that needs to be flushed to disk, utilize leveldb's batch writing
capability.

Github-Pull: PIVX-Project#636
Rebased-From: cd672cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.