Merge #14298: [REST] improve performance for JSON calls
Summary:
30973e9844 [REST] improve performance for JSON calls (Antoine Le Calvez)
Pull request description:
JSON calls do not use the raw data generated for the .bin and .hex calls. By moving the raw data creation into the .bin and .hex switch branches, JSON calls' performance is improved. Light benchmarking indicates that fetching 2000 JSON headers is ~25% faster, fetching large JSON blocks is ~4% faster.
Tree-SHA512: 433552c89bac2469d041b48a4a991d5443e4026a3ad7dc5621685386029f22826484218642fa5130c268349a55524ecbc4e30d64c867bd6632e0edd24370cf11
Backport of Core PR14298
Test Plan:
My computer is apparently too fast to measure these perf improvements reliably, but I tried this pre- and post-patch:
ninja check bitcoind -rest time curl localhost:8332/rest/headers/2000/<some-blockhash>.json time curl localhost:8332/rest/block/<some-blockhash>.json
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D5783