-
Notifications
You must be signed in to change notification settings - Fork 44
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
Quadratic duplicate message check #68
Comments
Motivation: Anything other than a linear runtime will be annoying to charge for in terms of gas. |
Stebalien
added a commit
that referenced
this issue
Oct 19, 2023
It's ~2% slower with 10 hashes and ~2% faster with 100 hashes (with very noisy benchmarks). But the important part is that the runtime should scale linearly with the number of inputs. E.g., this version is 2.5x faster for 1000 signatures. fixes #68
Stebalien
added a commit
that referenced
this issue
Oct 20, 2023
It's ~2% slower with 10 hashes and ~2% faster with 100 hashes (with very noisy benchmarks). But the important part is that the runtime should scale linearly with the number of inputs. E.g., this version is 2.5x faster for 1000 signatures. fixes #68
Stebalien
added a commit
that referenced
this issue
Oct 20, 2023
It's ~2% slower with 10 hashes and ~2% faster with 100 hashes (with very noisy benchmarks). But the important part is that the runtime should scale linearly with the number of inputs. E.g., this version is 2.5x faster for 1000 signatures. fixes #68
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now, the "fallback" duplicate check (when blst is disabled) is has a
n^2
runtime. Theblst
version is using a red/black tree and has alog(n)
runtime.I'd consider:
log(n)
runtime (e.g., useBTreeSet
).HashSet
for both. The rustHashSet
is pretty damn fast and avoids hashing entirely for small sets, IIRC, so we shouldn't have any issues there.The text was updated successfully, but these errors were encountered: