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

[REST] improve performance for JSON calls #14298

Merged
merged 1 commit into from Sep 24, 2018

Conversation

@alecalve
Copy link
Contributor

@alecalve alecalve commented Sep 23, 2018

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.

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 become faster.
@promag
Copy link
Member

@promag promag commented Sep 23, 2018

utACK 30973e9.

@Empact
Copy link
Member

@Empact Empact commented Sep 23, 2018

utACK 30973e9

@laanwj
Copy link
Member

@laanwj laanwj commented Sep 23, 2018

thanks, this is an obvious improvement, the whole point of the .bin interface is to save on conversion overhead!

30973e9

@practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Sep 24, 2018

utACK 30973e9

Nice first-time contribution!

@l2a5b1
Copy link
Contributor

@l2a5b1 l2a5b1 commented Sep 24, 2018

utACK 30973e9

nice one!

@MarcoFalke MarcoFalke merged commit 30973e9 into bitcoin:master Sep 24, 2018
2 checks passed
MarcoFalke added a commit that referenced this issue Sep 24, 2018
30973e9 [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
@alecalve alecalve deleted the improve_rest_json_performance branch Sep 24, 2018
mempko added a commit to meritlabs/merit that referenced this issue Sep 26, 2018
This is a change from downstream bitcoin: bitcoin/bitcoin#14298
@fanquake fanquake mentioned this pull request Oct 1, 2018
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this issue Apr 22, 2020
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 [[bitcoin/bitcoin#14298 | 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
ftrader added a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this issue Aug 17, 2020
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 [[bitcoin/bitcoin#14298 | 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
Munkybooty added a commit to Munkybooty/dash that referenced this issue Jul 9, 2021
30973e9 [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

# Conflicts:
#	src/rest.cpp
pravblockc added a commit to pravblockc/dash that referenced this issue Jul 22, 2021
30973e9 [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
pravblockc added a commit to pravblockc/dash that referenced this issue Aug 9, 2021
30973e9 [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
pravblockc added a commit to pravblockc/dash that referenced this issue Aug 9, 2021
30973e9 [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
pravblockc added a commit to pravblockc/dash that referenced this issue Aug 11, 2021
30973e9 [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
pravblockc added a commit to pravblockc/dash that referenced this issue Aug 11, 2021
30973e9 [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
5tefan added a commit to 5tefan/dash that referenced this issue Aug 12, 2021
30973e9 [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
@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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants