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

chore: SliceRemove minor optimization #3652

Merged
merged 127 commits into from
Dec 1, 2023
Merged

chore: SliceRemove minor optimization #3652

merged 127 commits into from
Dec 1, 2023

Conversation

vezenovm
Copy link
Contributor

Description

Problem*

Resolves this discussion #3617 (comment)

Summary*

Reference the discussion and the PR it is under for more context.

Additional Context

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [Exceptional Case] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

…y modify the predicate index for the non-dummy val
vezenovm and others added 17 commits November 30, 2023 17:43
# Description

## Problem\*

Resolves #2462 

## Summary\*

This PR simply builds upon #3617
by including some tests that use a dynamic index on SliceInsert and
SliceRemove.

## Additional Context

## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@vezenovm vezenovm requested a review from TomAFrench November 30, 2023 21:20
Copy link
Contributor

github-actions bot commented Nov 30, 2023

Changes to circuit sizes

Generated at commit: 41647fcb21b2991247c02a3208ba55543774655f, compared to commit: 5a4a73d24ddd7d2bb46c85714397ee6e031c97a6

🧾 Summary (10% most significant diffs)

Program ACIR opcodes (+/-) % Circuit size (+/-) %
slice_dynamic_index -16 ✅ -0.60% -24 ✅ -0.21%
slice_struct_field -310 ✅ -0.90% -450 ✅ -0.42%

Full diff report 👇
Program ACIR opcodes (+/-) % Circuit size (+/-) %
slice_dynamic_index 2,650 (-16) -0.60% 11,273 (-24) -0.21%
slice_struct_field 34,270 (-310) -0.90% 106,284 (-450) -0.42%

@TomAFrench
Copy link
Member

Can we remove this write operation entirely? We've already initialised the array so if we don't care about the value written here we can just leave it as is, right?

@vezenovm
Copy link
Contributor Author

vezenovm commented Dec 1, 2023

Can we remove this write operation entirely? We've already initialised the array so if we don't care about the value written here we can just leave it as is, right?

I switched to initializing without the original slice value to avoid having to clone the AcirValue. I will see how that reduces constraint counts because I lean towards optimizing the ACIR over the compiler.

@vezenovm
Copy link
Contributor Author

vezenovm commented Dec 1, 2023

@TomAFrench It looks to have reduced the ACIR opcodes for slice_struct_field by ~30 ACIR opcodes and ~100 backend constraints.

Copy link
Member

@TomAFrench TomAFrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. LGTM

@TomAFrench TomAFrench enabled auto-merge December 1, 2023 15:13
@TomAFrench TomAFrench added this pull request to the merge queue Dec 1, 2023
Merged via the queue into master with commit 36844fa Dec 1, 2023
33 checks passed
@TomAFrench TomAFrench deleted the mv/dyn-slice-opt branch December 1, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants