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

⚡ Simpler, faster response-data parser #201

Merged
merged 3 commits into from
Oct 21, 2023

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Oct 21, 2023

  • Converted the case statement to use upcase'd strings (not regexps)
  • Unified response_data and numeric_response into a single case statement, using a regexp for lookahead.
  • Sorted the case statement roughly in the order of frequency... but I need to collect more data to reliably make a claim about that. In the meantime, this order made sense to me... more or less. Current standard (both RFC3501 and RFC9051) responses are (mostly) sorted first, and deprecated, uncommon, unsupported, etc responses are sorted last.

Several versions were tried: `Hash[name].call`, `case name when regexp`,
`case name.to_sym`, etc, but benchmarks clearly showed `case
string.upcase when "str"` as fastest.

This change also documents which RFC covers which response types.
Use `peek_re(RE_RESPONSE_TYPE)` and the `TAGGED_EXT_LABEL` regexp, to
unify numeric and non-numeric types in the same case stmt.  This is much
simpler than two tier version, but I don't have benchmarks as to whether
or not this version of the code performs any better.

Add aliases for nz-number.  Not validating that the numbers are within
their allowed range, for now at least.
The case statement is sorted _roughly_ in the order of frequency...
but I need to collect more data to reliably make a claim about that.

In the meantime, this order made sense to me... more or less.

Current standard (both RFC3501 and RFC9051) responses are sorted first,
and deprecated, uncommon, unsupported, etc responses are sorted last.
@nevans nevans merged commit 5a92c75 into master Oct 21, 2023
22 checks passed
@nevans nevans deleted the parser/better-faster-cleaner-response_data branch October 21, 2023 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant