crates: improved json codec decoding performance #8718
+41
−68
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.
I wanted to benchmark my plugin on a big node so i made use of the giantnode script which sadly crashed at ~660k payments because my
/tmpwas full but whatever. I noticed again that the rust crates take way longer for rpc calls than on the cli even when using.call_raw(). I already know it was because of theMultiLineCodecbut wasn't sure if it could be made faster and if so why it was so slow. So naturally i asked an LLM and it basically oneshotted something like this PR.I tested this with a small plugin:
which gives the following results:
Before:
After:
So from ~81s down to ~13s for typed calls.
For comparison on the cli it's basically equal to the "after, raw" pays: ~10s
Tested on debian 13 with an AMD Ryzen 5900x and 64GB RAM