Skip to content

chore(acvm): Optimize logic ops under 128 bits#11916

Merged
TomAFrench merged 2 commits intomasterfrom
mv/optimize-logic-ops
Mar 19, 2026
Merged

chore(acvm): Optimize logic ops under 128 bits#11916
TomAFrench merged 2 commits intomasterfrom
mv/optimize-logic-ops

Conversation

@vezenovm
Copy link
Contributor

@vezenovm vezenovm commented Mar 18, 2026

Description

Problem

No issue just following up to #10222

Summary

On my M4 Macbook Pro:
bit_and/xor 8–128 bit: Old ~270 ns (got closer to 300ns as bit size increased) vs New ~65 ns (75% improvement)
bit_and/xor 254-bit (large): Old ~290 ns vs New ~259 ns

A mild improvement for large bit sizes and a large improvement for <= 128 bit sizes.

Additional Context

User Documentation

Check one:

  • No user documentation needed.
  • Changes in docs/ included in this PR.
  • [For Experimental Features] Changes in docs/ 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.

@vezenovm vezenovm added the bench-show Display benchmark results on PR label Mar 18, 2026
@socket-security
Copy link

socket-security bot commented Mar 18, 2026

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm lunr-languages is 95.0% likely obfuscated

Confidence: 0.95

Location: Package overview

From: ?npm/@easyops-cn/docusaurus-search-local@0.55.1npm/lunr-languages@1.14.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/lunr-languages@1.14.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm lunr-languages is 91.0% likely obfuscated

Confidence: 0.91

Location: Package overview

From: ?npm/@easyops-cn/docusaurus-search-local@0.55.1npm/lunr-languages@1.14.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/lunr-languages@1.14.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm markdown-it is 91.0% likely obfuscated

Confidence: 0.91

Location: Package overview

From: ?npm/typedoc@0.28.17npm/markdown-it@14.1.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/markdown-it@14.1.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: npm registry-auth-token is 94.0% likely obfuscated

Confidence: 0.94

Location: Package overview

From: ?npm/serve@14.2.6npm/registry-auth-token@3.3.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/registry-auth-token@3.3.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

ACVM Benchmarks

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
purely_sequential_opcodes 252878 ns/iter (± 533) 252365 ns/iter (± 2076) 1.00
perfectly_parallel_opcodes 222358 ns/iter (± 4341) 222791 ns/iter (± 3343) 1.00
perfectly_parallel_batch_inversion_opcodes 2734527 ns/iter (± 2992) 2729397 ns/iter (± 3770) 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Brillig Compilation Time

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 1.492 s 1.462 s 1.02
private-kernel-reset 1.46 s 1.532 s 0.95
private-kernel-tail 1.28 s 1.314 s 0.97
rollup-block-root-first-empty-tx 1.764 s 1.738 s 1.01
rollup-block-root-single-tx 1.8 s 1.78 s 1.01
rollup-block-root 1.69 s 1.82 s 0.93
rollup-checkpoint-merge 1.714 s 1.826 s 0.94
rollup-checkpoint-root-single-block 2.23 s 2.28 s 0.98
rollup-checkpoint-root 2.27 s 2.34 s 0.97
rollup-root 1.84 s 1.716 s 1.07
rollup-tx-base-private 1.968 s 1.968 s 1
rollup-tx-base-public 2.022 s 1.946 s 1.04
rollup-tx-merge 1.716 s 1.774 s 0.97
semaphore-depth-10 0.272 s 0.275 s 0.99
sha512-100-bytes 0.26 s 0.247 s 1.05

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Brillig Execution Time

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 0.035 s 0.029 s 1.21
private-kernel-reset 0.054 s 0.042 s 1.29
private-kernel-tail 0.004 s 0.005 s 0.80
rollup-block-root-first-empty-tx 0.003 s 0.003 s 1
rollup-block-root-single-tx 0.002 s 0.002 s 1
rollup-block-root 0.003 s 0.003 s 1
rollup-checkpoint-merge 0.001 s 0.001 s 1
rollup-root 0.002 s 0.002 s 1
rollup-tx-base-private 0.029 s 0.031 s 0.94
rollup-tx-base-public 0.035 s 0.034 s 1.03
rollup-tx-merge 0.002 s 0.002 s 1
semaphore-depth-10 0.007 s 0.007 s 1
sha512-100-bytes 0.014 s 0.014 s 1

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Elaboration Time

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 0.944 s 0.945 s 1.00
private-kernel-reset 0.919 s 0.972 s 0.95
private-kernel-tail 0.936 s 0.937 s 1.00
rollup-block-root-first-empty-tx 1.444 s 1.438 s 1.00
rollup-block-root-single-tx 1.46 s 1.47 s 0.99
rollup-block-root 1.46 s 1.48 s 0.99
rollup-checkpoint-merge 1.41 s 1.454 s 0.97
rollup-checkpoint-root-single-block 1.4 s 1.41 s 0.99
rollup-checkpoint-root 1.4 s 1.41 s 0.99
rollup-root 1.408 s 1.364 s 1.03
rollup-tx-base-private 1.428 s 1.446 s 0.99
rollup-tx-base-public 1.416 s 1.394 s 1.02
rollup-tx-merge 1.406 s 1.446 s 0.97
semaphore-depth-10 0.144 s 0.147 s 0.98
sha512-100-bytes 0.14 s 0.132 s 1.06

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Artifact Size

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 1041.2 KB 1041.2 KB 1
private-kernel-reset 2223.5 KB 2223.5 KB 1
private-kernel-tail 513.8 KB 513.8 KB 1
rollup-block-root-first-empty-tx 250.7 KB 250.7 KB 1
rollup-block-root-single-tx 254.4 KB 254.4 KB 1
rollup-block-root 329.2 KB 329.2 KB 1
rollup-checkpoint-merge 389.1 KB 389.1 KB 1
rollup-checkpoint-root-single-block 30703.6 KB 30703.6 KB 1
rollup-checkpoint-root 30752.6 KB 30752.6 KB 1
rollup-root 414.2 KB 414.2 KB 1
rollup-tx-base-private 5416.8 KB 5416.8 KB 1
rollup-tx-base-public 4717.6 KB 4717.6 KB 1
rollup-tx-merge 190.9 KB 190.9 KB 1
semaphore-depth-10 495.1 KB 495.1 KB 1
sha512-100-bytes 478.3 KB 478.3 KB 1

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Brillig Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 0.035 s 0.029 s 1.21
private-kernel-reset 0.054 s 0.042 s 1.29

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Compilation Time

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 2.712 s 2.7 s 1.00
private-kernel-reset 7.856 s 8.674 s 0.91
private-kernel-tail 2.388 s 2.636 s 0.91
rollup-block-root-first-empty-tx 1.814 s 1.792 s 1.01
rollup-block-root-single-tx 1.83 s 1.85 s 0.99
rollup-block-root 1.86 s 1.93 s 0.96
rollup-checkpoint-merge 1.778 s 1.846 s 0.96
rollup-checkpoint-root-single-block 316 s 319 s 0.99
rollup-checkpoint-root 323 s 326 s 0.99
rollup-root 1.838 s 1.762 s 1.04
rollup-tx-base-private 20.4 s 21.16 s 0.96
rollup-tx-base-public 100.26 s 95.44 s 1.05
rollup-tx-merge 1.772 s 1.81 s 0.98
semaphore-depth-10 1.111 s 1.13 s 0.98
sha512-100-bytes 2.238 s 1.959 s 1.14

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Execution Time

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 0.044 s 0.039 s 1.13
private-kernel-reset 0.176 s 0.166 s 1.06
private-kernel-tail 0.008 s 0.008 s 1
rollup-block-root-first-empty-tx 0.003 s 0.003 s 1
rollup-block-root-single-tx 0.002 s 0.003 s 0.67
rollup-block-root 0.004 s 0.004 s 1
rollup-checkpoint-merge 0.003 s 0.003 s 1
rollup-checkpoint-root-single-block 10.3 s 10.4 s 0.99
rollup-checkpoint-root 9.37 s 9.33 s 1.00
rollup-root 0.003 s 0.004 s 0.75
rollup-tx-base-private 0.327 s 0.358 s 0.91
rollup-tx-base-public 0.247 s 0.251 s 0.98
rollup-tx-merge 0.002 s 0.002 s 1
semaphore-depth-10 0.008 s 0.008 s 1
sha512-100-bytes 0.084 s 0.081 s 1.04

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Opcode count

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 19357 opcodes 19357 opcodes 1
private-kernel-reset 85412 opcodes 85412 opcodes 1
private-kernel-tail 8739 opcodes 8739 opcodes 1
rollup-block-root-first-empty-tx 1082 opcodes 1082 opcodes 1
rollup-block-root-single-tx 969 opcodes 969 opcodes 1
rollup-block-root 2152 opcodes 2152 opcodes 1
rollup-checkpoint-merge 1271 opcodes 1271 opcodes 1
rollup-checkpoint-root-single-block 1387945 opcodes 1387945 opcodes 1
rollup-checkpoint-root 1389123 opcodes 1389123 opcodes 1
rollup-root 1525 opcodes 1525 opcodes 1
rollup-tx-base-private 299181 opcodes 299181 opcodes 1
rollup-tx-base-public 254789 opcodes 254789 opcodes 1
rollup-tx-merge 1302 opcodes 1302 opcodes 1
semaphore-depth-10 5699 opcodes 5699 opcodes 1
sha512-100-bytes 13173 opcodes 13173 opcodes 1

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Brillig Artifact Size

Details
Benchmark suite Current: 83cd263 Previous: da19a54 Ratio
private-kernel-inner 816.1 KB 816.1 KB 1
private-kernel-reset 737.7 KB 737.7 KB 1
private-kernel-tail 358.6 KB 358.6 KB 1
rollup-block-root-first-empty-tx 299.1 KB 299.1 KB 1
rollup-block-root-single-tx 303.8 KB 303.8 KB 1
rollup-block-root 366.6 KB 366.6 KB 1
rollup-checkpoint-merge 283.2 KB 283.2 KB 1
rollup-checkpoint-root-single-block 570.1 KB 570.1 KB 1
rollup-checkpoint-root 613 KB 613 KB 1
rollup-root 432.2 KB 432.2 KB 1
rollup-tx-base-private 674.2 KB 674.2 KB 1
rollup-tx-base-public 839 KB 839 KB 1
rollup-tx-merge 219.8 KB 219.8 KB 1
semaphore-depth-10 2065.9 KB 2065.9 KB 1
sha512-100-bytes 168.1 KB 168.1 KB 1

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Test Suite Duration

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
test_report_AztecProtocol_aztec-packages_noir-projects_aztec-nr 245 s 245 s 1
test_report_AztecProtocol_aztec-packages_noir-projects_noir-contracts 183 s 192 s 0.95
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_blob 361 s 365 s 0.99
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_private-kernel-lib 485 s 485 s 1
test_report_AztecProtocol_aztec-packages_noir-projects_noir-protocol-circuits_crates_types 138 s 141 s 0.98
test_report_noir-lang_noir-bignum_ 188 s 194 s 0.97
test_report_noir-lang_noir_bigcurve_ 419 s 454 s 0.92
test_report_noir-lang_sha256_ 19 s 19 s 1
test_report_noir-lang_sha512_ 14 s 13 s 1.08
test_report_zkpassport_noir-ecdsa_ 3 s 2 s 1.50
test_report_zkpassport_noir_rsa_ 1 s 2 s 0.50

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Execution Memory

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 275.96 MB 275.96 MB 1
private-kernel-reset 312.7 MB 312.7 MB 1
private-kernel-tail 265.37 MB 265.37 MB 1
rollup-block-root 346.8 MB 346.8 MB 1
rollup-checkpoint-merge 345.19 MB 345.19 MB 1
rollup-checkpoint-root-single-block 1570 MB 1570 MB 1
rollup-checkpoint-root 1570 MB 1570 MB 1
rollup-root 346.12 MB 346.12 MB 1
rollup-tx-base-private 529.14 MB 529.14 MB 1
rollup-tx-base-public 464.95 MB 464.95 MB 1
rollup-tx-merge 344.81 MB 344.81 MB 1
semaphore_depth_10 75.45 MB 75.45 MB 1
sha512_100_bytes 72.88 MB 72.88 MB 1

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Compilation Memory

Details
Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
private-kernel-inner 293 MB 293 MB 1
private-kernel-reset 507.87 MB 507.87 MB 1
private-kernel-tail 266.45 MB 266.45 MB 1
rollup-block-root-first-empty-tx 346.55 MB 346.55 MB 1
rollup-block-root-single-tx 345.42 MB 345.42 MB 1
rollup-block-root 348.37 MB 348.37 MB 1
rollup-checkpoint-merge 346.34 MB 346.34 MB 1
rollup-checkpoint-root-single-block 10320 MB 10320 MB 1
rollup-checkpoint-root 10320 MB 10320 MB 1
rollup-root 348.78 MB 348.78 MB 1
rollup-tx-base-private 1070 MB 1070 MB 1
rollup-tx-base-public 2810 MB 2810 MB 1
rollup-tx-merge 345.52 MB 345.52 MB 1
semaphore_depth_10 99.2 MB 99.2 MB 1
sha512_100_bytes 185.48 MB 185.44 MB 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vezenovm vezenovm requested a review from TomAFrench March 19, 2026 15:09
@TomAFrench TomAFrench enabled auto-merge March 19, 2026 15:10
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 83cd263 Previous: 37725f5 Ratio
test_report_zkpassport_noir-ecdsa_ 3 s 2 s 1.50

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

@TomAFrench TomAFrench added this pull request to the merge queue Mar 19, 2026
Merged via the queue into master with commit c5475e3 Mar 19, 2026
139 checks passed
@TomAFrench TomAFrench deleted the mv/optimize-logic-ops branch March 19, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bench-show Display benchmark results on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants