-
Notifications
You must be signed in to change notification settings - Fork 200
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
chore(parser): Parser error optimisation #1292
Conversation
- switching labels to enums - Using LateAllocSet in place of BTreeSet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, I appreciate the timing information as well. Have you tested against existing small set crates? There aren't many but I wonder it one of those fits our usecase any better.
Just noticed these changes throw up the following clippy warning:
Guess I better benchmark I'm aware that I've spent more time on this PR than it's really worth - so shout if you think I should abandon. |
I think this PR is still a worthwhile pursuit, its nice to have the timing information so that we know for later what any performance characteristics are like. I'm interested in what the performance of tinyset would be as well? Is it an easy slot-in replacement for small-ord-set? |
I had a go at pub trait Fits64: Copy {
/// Convert back *from* a u64. This is unsafe, since it is only
/// infallible (and lossless) if the `u64` originally came from
/// type `Self`.
unsafe fn from_u64(x: u64) -> Self;
/// Convert to a `u64`. This should be infallible.
fn to_u64(self) -> u64;
} Probably the biggest hurdle is you'd need to map to some alternative representation of a token that's able to support the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I have one final question but I don't want to hold this PR any longer.
* phated/acvm-0.12.0: (45 commits) chore!: Update to ACVM 0.12.0 official release of backend feat: use dummy constructor for bb call chore: add missing `?` chore: use `try_vecmap` in old `vecmap` locations chore: update `acvm-backend-barretenberg` to 0.1.0 commit latest master fix: improve variable resolution test: re enabled sort test chore: update cargo tomls feat: adapted to heterogeneous bb calls remove unneeded import fix grep problems chore: replace long `Backend` type parameters with `B` update to latest commit chore: Make CliError generic over a Backend chore: Update nargo core to return backend errors chore!: Update to acvm 0.11.0 chore(parser): Parser error optimisation (#1292) chore(ssa refactor): Implement function inlining (#1293) ...
* master: (66 commits) feat(nargo)!: retire print-acir in favour of flag (#1328) chore(ssa): enable cse for assert (#1350) chore(ssa refactor): Add basic instruction simplification (#1329) chore(noir): Release 0.6.0 (#1279) feat: enable to_radix for any field element (#1343) chore(ssa refactor): Simplify inlining pass and fix inlining failure (#1337) chore!: Update to acvm 0.11.0 (#1322) feat: Add ECDSA secp256k1 builtin test (#1294) chore: add support for encoding/decoding inputs from JSON (#1325) feat: Issue an error when attempting to use a `return` expression (#1330) chore(ssa refactor): Fix inlining bug (#1335) fix: to-bits and to-radix for > 128 bits (#1312) chore(parser): Parser error optimisation (#1292) chore(ssa refactor): Implement function inlining (#1293) chore: fix installation link in readme (#1326) chore: fix installation link in readme (#1326) feat(stdlib): Add keccak (#1249) fix: Parsing nested generics (#1319) chore(ssa refactor): Document some SSA-gen functions (#1321) fix: Assigning to tuple fields (#1318) ...
Related issue(s)
Resolves #
Description
Summary of changes
tl;dr
~40% speed up in release mode
~10% speed up in debug mode
Chumsky produces and aggregates large numbers of errors in normal operation regardless of whether it's on the happy path. This is because as it tries each grammar rule in turn, it produces an error until the matching rule is encountered. Currently our error construction and aggregation is rather expensive, largely in due to the construction and destruction of
BTreeSet
s that may hold zero or very few items.This PR uses
SmallOrdSet
to avoid heap allocations as long as possible.Other changes:
Samples taken using
time nargo print-acir
Dependency additions / changes
Test additions / changes
Checklist
cargo fmt
with default settings.Documentation needs
Additional context