Skip to content

feat: add Decoder.SetMaxFieldLength#208

Open
wojas wants to merge 1 commit into
CrowdStrike:mainfrom
wojas:decoder-max-field-length
Open

feat: add Decoder.SetMaxFieldLength#208
wojas wants to merge 1 commit into
CrowdStrike:mainfrom
wojas:decoder-max-field-length

Conversation

@wojas

@wojas wojas commented Jan 7, 2026

Copy link
Copy Markdown

Add a Decoder.SetMaxFieldLength method to allow overriding the default field limit of 2GB, as described in issue #207.

This PR also adds a test for the feature and ensures that nothing changes for existing code.

benchstat

goos: darwin
goarch: arm64
pkg: github.com/CrowdStrike/csproto
cpu: Apple M1 Pro
                    │   old.txt   │              new.txt               │
                    │   sec/op    │   sec/op     vs base               │
EncodeString-10       5.589n ± 0%   5.564n ± 0%       ~ (p=0.218 n=50)
SafeDecodeString-10   17.96n ± 1%   17.69n ± 0%  -1.50% (p=0.000 n=50)
FastDecodeString-10   8.194n ± 0%   8.104n ± 0%  -1.09% (p=0.000 n=50)
DecodeFixed32-10      5.369n ± 1%   5.460n ± 1%  +1.70% (p=0.000 n=50)
DecodeFixed64-10      5.394n ± 1%   5.478n ± 1%  +1.56% (p=0.000 n=50)
geomean               7.505n        7.508n       +0.03%

add Decoder.SetMaxFieldLength method to allow overriding the default
field limit of 2GB.
@wojas wojas changed the title feat: add Decoder.SetMaxFieldLength (#207) feat: add Decoder.SetMaxFieldLength Jan 7, 2026
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.

1 participant