Skip to content

Conversation

sipa
Copy link
Member

@sipa sipa commented Mar 20, 2012

I did a full block load (from a local file, using the loadblocks patch) on my laptop with these settings in 33 minutes.

@jgarzik
Copy link
Contributor

jgarzik commented Mar 20, 2012

ACK. The one-line checkpointing change probably had the largest impact.

@sipa
Copy link
Member Author

sipa commented Mar 20, 2012

@jgarzik:

Time to load 133k blocks:

NF: 30.4
LC: 8.6
LC+NF: 5.1
LC+NF+NS: 5.0

LC = large cache (100 MiB cache, 100 MiB log, 10 MiB log buffer)
NF = no flushing every 500 blocks
NS = open database env with DB_TX_WRITE_NOSYNC

The larger db cache size has the largest impact.

@laanwj
Copy link
Member

laanwj commented Mar 21, 2012

ACK. Nice!

@jgarzik
Copy link
Contributor

jgarzik commented Mar 21, 2012

Interesting. I guess the large cache helps with all the lookups needed to validate each block. Because we are looking up random hashes, there is likely zero cache locality from one lookup to the next.

@gavinandresen
Copy link
Contributor

ACK

@sipa
Copy link
Member Author

sipa commented Mar 21, 2012

The only thing I'm worried about is that the longer interval between log flushes means more/larger log files, which may causes out of disk space errors.

@gmaxwell
Copy link
Contributor

During the initial syncup you end up with ~2 gigs of database logs in any case— we don't clean them up until shutdown (or the next startup? I forget).

I've tested this on three systems, ACK.

gavinandresen added a commit that referenced this pull request Mar 22, 2012
Speed up block downloading
@gavinandresen gavinandresen merged commit 0e894be into bitcoin:master Mar 22, 2012
coblee referenced this pull request in litecoin-project/litecoin Jul 17, 2012
Speed up block downloading
namecoin-qt referenced this pull request in namecoin-qt/namecoin-qt Jun 12, 2013
Speed up block downloading
davispuh referenced this pull request in davispuh/namecoin Feb 18, 2014
Speed up block downloading
suprnurd pushed a commit to chaincoin-legacy/chaincoin that referenced this pull request Dec 5, 2017
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Oct 30, 2019
…mmands

983d97a [Refactor] Combine parameter checking of budget commands (Cave Spectre)

Pull request description:

  ### **Release notes**
  - [Refactor] Move common budget parameter checking code into a function

  ### **Details**
  The code in both `preparebudget` and `submitbudget` used the same parameter checking.  This pulls that parameter checking and loading into a common routine used by both; for ease of improvements and adjustments to the parameter checking... so the risk of not adjusting them consistently in both routines is removed.

  ### **Note**
  The early discussion below is based on a combined PR that addressed this, plus bitcoin#950 and a PR to be named later.  The decision was made to split and focus; so the discussions can be independent of each other and refactor as needed.

ACKs for top commit:
  Fuzzbawls:
    ACK 983d97a
  random-zebra:
    ACK PIVX-Project@983d97a

Tree-SHA512: a88eb41e06d1936db77f1cd9c4f04360b446c48d27652d57dfd6e4b119140d56e24b24e00e0ac48890cc78d4130f8f688a711f74899f9c9301d1aba22dff5315
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Oct 30, 2019
7261134 [Review] Convert runtime_error to JSONRPCError (Cave Spectre)
f7ac53b [RPC] Correct issues with budget commands (Cave Spectre)

Pull request description:

  ### **Release notes**
  - [RPC] Fix potential wallet crashes in budget commands
  - [RPC] Remove unnecessary conditionals in parameter checking of budget commands

  ### **Details**
  **wallet segfault**
  `preparebudget`, invoked before the wallet has fully started, caused a segfault and crashed.  This was due to the lack of checking for `pwalletMain` before referencing cs_wallet.  This is solved with a throw error to tell the user to try again after the wallet has started.

  Furthermore; both `preparebudget` and `submitbudget` has a check for `pindexPrev` to conditionalize the assignment of nBlockMin (which references `pindexPrev->nHeight`); however later checks, `pindexPrev->nHeight` is referenced even if the pindexPrev check failed; which would have caused a crash if pindexPrev was NULL.  This would occur if `chainActive->Tip()` returns null.  Given the logic of `getnextsuperblock`, the check added to preparebudget and submitbudget will generate a throw error if there is no active chain tip.

  **Remove unnecessary conditionals and code**
  `pindexPrev` is loaded from `chainActive.Tip()` pindexPrev->nHeight is checked multiple times in the parameter checking.  For ease of reading, pindexPrev->nHeight is now saved in a variable as it is used multiple times in the execution of the RPC commands in question.  Likewise, two function calls are used to determine the constant length of a budget cycle `Params().GetBudgetCycleBlocks()`; and is used several times.  Storing this information in a constant is more efficient then several calls for the information.

  nBlockMin is determined (the next superblock).  However later nNext was defined to be the exact same thing.  It's not necessary to build them both.

  By nature of validating that the chosen budget cycle block is greater than the current block, and validating the number of cycles is greater than zero; the need to check the end of the budget cycle is unnecessary.

  Having a separate throw message for choosing the wrong block (not a budget block), and specifying a block that has passed is unnecessary.  These have been combined so that the user, putting in the wrong block, is informed, in both cases, what the next budget block is.

  ### **Note**
  This PR was originally part of bitcoin#964, but split out to distinguish between these changes and the other's refactoring.

ACKs for top commit:
  random-zebra:
    ACK PIVX-Project@7261134
  Fuzzbawls:
    ACK 7261134

Tree-SHA512: b0ccabae52d02767971104353b48d4efb76926017d7099b52b341d525710aa3a70d343c92c260048bb1c288990a914730a4dd0832578f07e96abb384d628cd4e
Losangelosgenetics pushed a commit to Losangelosgenetics/bitcoin that referenced this pull request Mar 12, 2020
*Total -- 2,933.84kb -> 1,897.69kb (35.32%)

/googlefonts-qa/notes/assets/2019-03-28-14-50-52.png -- 38.75kb -> 13.06kb (66.31%)
/googlefonts-qa/notes/assets/2019-03-28-14-51-33.png -- 34.91kb -> 11.91kb (65.88%)
/googlefonts-qa/notes/assets/2019-03-28-15-00-56.png -- 46.90kb -> 16.74kb (64.32%)
/showcases/all_ligatures.png -- 301.00kb -> 122.76kb (59.22%)
/fira_code_patreon.png -- 41.59kb -> 17.17kb (58.71%)
/googlefonts-qa/notes/assets/2019-03-28-14-52-48.png -- 21.88kb -> 9.40kb (57.03%)
/showcases/clojure.png -- 45.40kb -> 19.76kb (56.47%)
/showcases/swift.png -- 44.94kb -> 19.73kb (56.1%)
/googlefonts-qa/notes/assets/2019-03-27-13-47-09.png -- 19.22kb -> 8.44kb (56.1%)
/googlefonts-qa/notes/assets/2019-03-28-14-51-48.png -- 20.35kb -> 9.03kb (55.64%)
/showcases/erlang.png -- 34.56kb -> 15.33kb (55.62%)
/showcases/elixir.png -- 68.45kb -> 30.44kb (55.54%)
/googlefonts-qa/notes/assets/2019-03-28-14-58-50.png -- 21.90kb -> 9.84kb (55.09%)
/showcases/go.png -- 34.87kb -> 15.72kb (54.92%)
/googlefonts-qa/notes/assets/2019-03-27-13-47-20.png -- 18.38kb -> 8.32kb (54.73%)
/showcases/livescript.png -- 27.09kb -> 12.32kb (54.53%)
/showcases/php.png -- 42.92kb -> 19.67kb (54.18%)
/showcases/javascript.png -- 71.18kb -> 33.04kb (53.58%)
/showcases/ruby.png -- 48.00kb -> 22.53kb (53.07%)
/showcases/stylistic_sets.png -- 70.38kb -> 33.75kb (52.05%)
/googlefonts-qa/notes/assets/2019-03-28-14-24-45.png -- 15.36kb -> 7.56kb (50.77%)
/showcases/feature_calt_centering.png -- 66.51kb -> 36.21kb (45.56%)
/googlefonts-qa/notes/assets/2019-03-27-13-41-12.png -- 10.13kb -> 6.00kb (40.76%)
/googlefonts-qa/notes/assets/2019-03-27-13-50-55.png -- 45.71kb -> 31.51kb (31.06%)
/googlefonts-qa/notes/assets/2019-03-27-13-38-30.png -- 17.42kb -> 12.22kb (29.84%)
/googlefonts-qa/notes/assets/2019-03-28-13-56-45.png -- 39.61kb -> 27.82kb (29.77%)
/googlefonts-qa/notes/assets/2019-03-27-13-39-56.png -- 27.76kb -> 19.91kb (28.27%)
/googlefonts-qa/notes/assets/2019-03-28-13-51-49.png -- 32.01kb -> 22.96kb (28.26%)
/googlefonts-qa/notes/assets/2019-03-28-13-50-54.png -- 45.29kb -> 32.74kb (27.71%)
/googlefonts-qa/notes/assets/2019-03-28-13-51-24.png -- 45.29kb -> 32.74kb (27.71%)
/googlefonts-qa/notes/assets/2019-03-27-13-51-17.png -- 44.18kb -> 31.97kb (27.63%)
/googlefonts-qa/notes/assets/2019-03-28-14-13-00.png -- 30.60kb -> 22.31kb (27.07%)
/googlefonts-qa/notes/assets/2019-03-28-13-50-14.png -- 47.49kb -> 34.70kb (26.95%)
/googlefonts-qa/notes/assets/2019-03-28-13-49-19.png -- 45.97kb -> 34.06kb (25.9%)
/googlefonts-qa/notes/assets/2019-03-28-15-00-36.png -- 93.45kb -> 69.56kb (25.57%)
/googlefonts-qa/notes/assets/2019-03-28-14-56-24.png -- 54.86kb -> 41.05kb (25.17%)
/googlefonts-qa/notes/assets/2019-03-28-14-54-14.png -- 21.56kb -> 16.18kb (24.96%)
/googlefonts-qa/notes/assets/2019-03-28-13-53-22.png -- 67.89kb -> 51.20kb (24.59%)
/googlefonts-qa/notes/assets/2019-03-28-14-56-15.png -- 52.44kb -> 39.59kb (24.49%)
/googlefonts-qa/notes/assets/2019-03-28-14-21-39.png -- 51.49kb -> 39.30kb (23.68%)
/googlefonts-qa/notes/assets/2019-03-28-14-20-11.png -- 61.41kb -> 46.96kb (23.53%)
/googlefonts-qa/notes/assets/2019-03-28-14-53-56.png -- 21.29kb -> 16.29kb (23.47%)
/googlefonts-qa/notes/assets/2019-03-27-13-46-21.png -- 30.67kb -> 23.65kb (22.89%)
/googlefonts-qa/notes/assets/2019-03-27-13-35-37.png -- 47.29kb -> 36.53kb (22.74%)
/googlefonts-qa/notes/assets/2019-03-28-13-58-57.png -- 36.03kb -> 28.16kb (21.83%)
/googlefonts-qa/notes/assets/2019-03-28-13-44-06.png -- 50.85kb -> 39.76kb (21.81%)
/googlefonts-qa/notes/assets/2019-03-27-13-52-23.png -- 28.85kb -> 22.63kb (21.54%)
/googlefonts-qa/notes/assets/2019-03-28-14-18-46.png -- 58.46kb -> 46.00kb (21.32%)
/googlefonts-qa/notes/assets/2019-03-28-13-58-48.png -- 36.92kb -> 29.22kb (20.87%)
/googlefonts-qa/notes/assets/2019-03-27-13-48-03.png -- 35.00kb -> 27.87kb (20.36%)
/googlefonts-qa/notes/assets/2019-03-28-13-39-03.png -- 23.78kb -> 18.98kb (20.16%)
/googlefonts-qa/notes/assets/2019-03-28-13-48-15.png -- 31.81kb -> 25.40kb (20.14%)
/googlefonts-qa/notes/assets/2019-03-28-14-11-13.png -- 56.72kb -> 45.33kb (20.07%)
/googlefonts-qa/notes/assets/2019-03-28-14-04-50.png -- 46.60kb -> 37.32kb (19.92%)
/googlefonts-qa/notes/assets/2019-03-28-14-17-52.png -- 69.54kb -> 55.69kb (19.91%)
/googlefonts-qa/notes/assets/2019-03-28-14-13-32.png -- 49.96kb -> 40.49kb (18.96%)
/googlefonts-qa/notes/assets/2019-03-27-13-53-17.png -- 26.72kb -> 21.69kb (18.82%)
/googlefonts-qa/notes/assets/2019-03-28-13-41-49.png -- 42.56kb -> 34.73kb (18.41%)
/googlefonts-qa/notes/assets/2019-03-28-14-01-13.png -- 41.62kb -> 34.00kb (18.31%)
/googlefonts-qa/notes/assets/2019-03-28-13-42-04.png -- 29.72kb -> 24.95kb (16.05%)
/googlefonts-qa/notes/assets/2019-03-28-14-10-07.png -- 22.53kb -> 19.49kb (13.48%)
/googlefonts-qa/notes/assets/2019-03-28-13-47-00.png -- 19.25kb -> 16.80kb (12.72%)
/googlefonts-qa/notes/assets/2019-03-28-13-40-08.png -- 26.67kb -> 23.28kb (12.71%)
/googlefonts-qa/notes/assets/2019-03-27-13-40-23.png -- 14.16kb -> 12.41kb (12.39%)
/googlefonts-qa/notes/assets/2019-03-28-14-03-53.png -- 37.22kb -> 32.66kb (12.25%)
/googlefonts-qa/notes/assets/2019-03-28-14-25-49.png -- 24.21kb -> 22.83kb (5.74%)
/showcases/fira_code_logo.svg -- 56.30kb -> 56.01kb (0.52%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>

Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
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.

5 participants