-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
rpc: O(N**2) batch response matching #22805
Milestone
Comments
I will fix it. |
fjl
changed the title
O(N**2) batch response matching
rpc: O(N**2) batch response matching
May 17, 2021
Hey @fjl 👋 !! |
No, not yet. I consider this low priority because batch requests are not used much. Even if used, I would consider it rare to use hundreds of requests in one batch. That said, I will fix it as soon as I get to it. |
fjl
added a commit
that referenced
this issue
Nov 4, 2021
This avoids quadratic time complexity in the lookup of the batch element corresponding to an RPC response. Unfortunately, the new approach requires additional memory for the mapping from ID to index. Fixes #22805
sidhujag
pushed a commit
to syscoin/go-ethereum
that referenced
this issue
Nov 4, 2021
This avoids quadratic time complexity in the lookup of the batch element corresponding to an RPC response. Unfortunately, the new approach requires additional memory for the mapping from ID to index. Fixes ethereum#22805
yongjun925
pushed a commit
to DODOEX/go-ethereum
that referenced
this issue
Dec 3, 2022
This avoids quadratic time complexity in the lookup of the batch element corresponding to an RPC response. Unfortunately, the new approach requires additional memory for the mapping from ID to index. Fixes ethereum#22805
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
go-ethereum/rpc/client.go
Lines 367 to 392 in fc1c1cb
We scan the N=
len(b)
responses and for each we scan throughmsgs
to look for the one with anID
that matches. For large batches, if the response ID order is in reverse of the batch order, we can get O(N**2) runtime in the matching.It may be okay to just add a comment to say do not use large batches in the interface, but ideally this shsould be fixed.
The text was updated successfully, but these errors were encountered: