Skip to content

Commit

Permalink
chore(parser): tweak SmallOrdSet sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
joss-aztec committed May 9, 2023
1 parent 78110be commit 32d1d56
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/noirc_frontend/src/parser/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ pub enum ParserErrorReason {
/// reason we use `SmallOrdSet` to avoid heap allocations for as long as possible - this greatly
/// inflates the size of the error, but this is justified by a resulting increase in parsing
/// speeds of approximately 40% in release mode.
///
/// Both `expected_tokens` and `expected_labels` use `SmallOrdSet` sized 1. In the of labels this
/// is optimal. In the of tokens we stop here due to fast diminishing returns.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ParserError {
expected_tokens: SmallOrdSet<[Token; 3]>,
expected_labels: SmallOrdSet<[ParsingRuleLabel; 3]>,
expected_tokens: SmallOrdSet<[Token; 1]>,
expected_labels: SmallOrdSet<[ParsingRuleLabel; 1]>,
found: Token,
reason: Option<ParserErrorReason>,
span: Span,
Expand Down

0 comments on commit 32d1d56

Please sign in to comment.