Skip to content

✨ Add options to improve performances - #17

Merged
ets-dorian merged 5 commits into
devfrom
options
May 17, 2026
Merged

✨ Add options to improve performances#17
ets-dorian merged 5 commits into
devfrom
options

Conversation

@ets-dorian

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds opt-in performance options to the public parser API (SkipUnknownPayloads, SkipParameterParsing, SkipCommands, SkipTargetEventCodes) plumbed via a new types.Config on the parsing context, re-exports the protocol command/event constants under the photon package so users can build option calls, and tightens reliable-payload length accounting in the command/reliable parsers.

Changes:

  • New Option/Config machinery (options.go, internal/types/config.go) wired through NewV16/NewV18/ParseV16/ParseV18 and internal/context.NewContext.
  • Skip logic added in internal/command/command.go and internal/command/reliable/reliable.go, and reliable-payload length passed explicitly (payloadLen) instead of the previous READED_HEADER_SIZE constant.
  • New tests and benchmarks in parser_test.go exercising the four skip options on dataset 3/1.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
options.go Defines Option, DefaultConfig, and the four Skip* option constructors.
internal/types/config.go Introduces the Config struct used by the parsing context.
types.go Adds re-exported aliases and re-declares CommandType/Type constants in the public package.
parser.go NewV16/NewV18/ParseV16/ParseV18 accept ...Option and forward a built Config to the context.
internal/context/context.go Context gains a Config field and NewContext requires it.
internal/command/command.go Honors SkipUnknownPayloads/SkipCommands, emits unknown payloads, and bounds-checks reliable payload length.
internal/command/reliable/reliable.go Replaces READED_HEADER_SIZE with a per-call start/payloadLen, adds SkipParameterParsing/SkipTargetEventCodes shortcuts.
internal/command/reliable/fragment.go Passes the assembled buffer length as payloadLen after reset.
internal/session/session_test.go Updates NewContext call sites to pass types.Config{}.
parser_test.go Adds four Without* tests and two new benchmarks for the skip options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread types.go Outdated
Comment thread types.go Outdated
Comment thread internal/command/command.go Outdated
Comment thread internal/command/command.go
Comment thread internal/command/command.go
Comment thread internal/command/reliable/reliable.go
Comment thread options.go
Comment thread internal/types/config.go Outdated
Comment thread parser_test.go
Comment thread parser_test.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.

Comment thread internal/session/session.go
Comment thread internal/session/session_test.go
Comment thread parser_test.go
Comment thread parser_test.go
Comment thread README.md
Comment thread parser.go
@ets-dorian
ets-dorian merged commit 3cacc0a into dev May 17, 2026
3 checks passed
@ets-dorian
ets-dorian deleted the options branch May 17, 2026 04:44
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.

3 participants