Skip to content

Conversation

TomAFrench
Copy link
Member

Description

Problem*

Resolves

Summary*

This PR pulls out @jialinli98's commit in #61

Additional Context

PR Checklist*

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

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 'ACIR Opcodes'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.01.

Benchmark suite Current: 9d1c441 Previous: b494199 Ratio
parse_json_from_string_JSON16kb_Bench.json/main 1094548 acir_opcodes 906131 acir_opcodes 1.21
parse_json_from_string_JSON512b_Bench.json/main 38027 acir_opcodes 32545 acir_opcodes 1.17

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 'Circuit Size'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.01.

Benchmark suite Current: 9d1c441 Previous: b494199 Ratio
parse_json_from_string_JSON16kb_Bench.json/main 1469079 circuit_size 1243803 circuit_size 1.18
parse_json_from_string_JSON512b_Bench.json/main 68568 circuit_size 63403 circuit_size 1.08

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 Bytecode Size'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.01.

Benchmark suite Current: 02af66e Previous: b494199 Ratio
parse_json_from_string_JSON16kb_Bench 17177 opcodes 16999 opcodes 1.01
parse_json_from_string_JSON512b_Bench 17168 opcodes 16990 opcodes 1.01

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

@@ -607,6 +607,36 @@ impl<let NumBytes: u32, let NumPackedFields: u32, let MaxNumTokens: u32, let Max
let index_valid: Field = range_valid[i] as Field;
// 1 gate
let entry = TranscriptEntry::to_field(TranscriptEntry { token, index, length });

if token == LITERAL_TOKEN as Field {
index.assert_max_bit_size::<8>();
Copy link
Member Author

Choose a reason for hiding this comment

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

I've moved this range constraint to sit before the cast to u32 to ensure that we don't truncate.

Comment on lines +614 to +617
let first_char = self.json[index_as_u32];
let second_char = self.json[index_as_u32 + 1];
let third_char = self.json[index_as_u32 + 2];
let fourth_char = self.json[index_as_u32 + 3];
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm pulling these array reads out to be unconditional

& (fifth_char == 101); // 'e'
assert(is_false, "invalid literal");
} else {
assert_eq(length, 4, "invalid literal");
Copy link
Member Author

Choose a reason for hiding this comment

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

We can just assert on the length here to avoid having a predicate in this branch.

@TomAFrench
Copy link
Member Author

@jialinli98 I've pulled out these changes from #61 so that we can inspect these changes in isolation.

@TomAFrench TomAFrench requested a review from jialinli98 August 6, 2025 14:19
@TomAFrench TomAFrench merged commit 8adc6a8 into main Aug 6, 2025
16 checks passed
@github-project-automation github-project-automation bot moved this from 👀 To Triage to ✅ Done in Noir Libraries Aug 6, 2025
@github-actions github-actions bot mentioned this pull request Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants