-
Notifications
You must be signed in to change notification settings - Fork 958
Make Json rpc more efficient #8585
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
Open
rustyrussell
wants to merge
14
commits into
ElementsProject:master
Choose a base branch
from
rustyrussell:json-rpc-more-efficient
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Make Json rpc more efficient #8585
rustyrussell
wants to merge
14
commits into
ElementsProject:master
from
rustyrussell:json-rpc-more-efficient
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Without this they get run together on stderr. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We have to call it membuf_tal_resize() because the other on is a ccan/json_out static function! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We do this in several places, might as well make it common code. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…-pay. They were never referenced, and saving the toks is questionable since their lifetime is not guaranteed to live beyond this call (at least the buffer was duplicated, but that also assumed it was at the start of the object). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The efficient way to do this is to use membuf, which handles the buffer control (only using memmove when necessary). We have multiple places where we opencoded this, some of which did not use membuf at all. So now we create common infrastructure. I tried making it a single function but the various users are quite different, so instead I opted for a toolbox approach. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This will also be more efficient than doing memmove every time. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Hand it in as a parameter to reduce churn in next patch. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is also more efficient if there are many commands at once. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Hand it in as a parameter to reduce churn in the next patch. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is more efficient if we have lots of incoming commands, too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is a trick from bcli: we ask bitcoind for the block, and it hands us a 2MB hex blob (which we read in multiple parts). Our parser wades through it all, but a quick search for '}' makes it much faster. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…se_handle off plugin->buffer. Hand buffer in as a parameter to reduce churn in the next patch. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
It's a little overkill, but it's clear. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
a460471
to
71e9f48
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unify all the places where we read JSONRPC, using membuf which is the most efficient way, which we didn't always use.
Changelog-None