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

blocksync: Some performance improvements on top of #3957 #3985

Merged
merged 3 commits into from
Sep 2, 2020

Commits on Sep 2, 2020

  1. bcli: Avoid tal_fmt when handling a raw hex block

    We were using `tal_fmt` to truncate off the last byte of the
    response (newline), which required an allocation, a call to `vsnprintf` and a
    copy of the block contents. This being >2MB in size on mainnet was rather
    expensive.
    
    We now just signal the end of the string by overwriting the trailing newline,
    and stealing directly onto the result.
    cdecker authored and rustyrussell committed Sep 2, 2020
    Configuration menu
    Copy the full SHA
    016d1e9 View commit details
    Browse the repository at this point in the history
  2. block: Compute the txids only once

    We're not going to mutate transactions in a block, so computing the txids
    every time we need them is a waste, let's compute them upfront and use them
    afterwards.
    cdecker authored and rustyrussell committed Sep 2, 2020
    Configuration menu
    Copy the full SHA
    912a118 View commit details
    Browse the repository at this point in the history
  3. json: Only start parsing once we're sure we have a message

    PR ElementsProject#3957 improved performance considerably, however we still look over the
    entire message for the message separator. If instead we just look in the
    incrementally read data, we remove the quadratic behavior for large messages.
    
    This is safe since we then loop over the messages which would drain any
    message separator from the buffer before we attempt the next read.
    
    Changelog-Fixed: bcli: Significant speedups for block synchronization
    cdecker authored and rustyrussell committed Sep 2, 2020
    Configuration menu
    Copy the full SHA
    64f2dcb View commit details
    Browse the repository at this point in the history