Skip to content

Conversation

@klauspost
Copy link
Collaborator

  • Read header before decoding (effectively unrolls reads)
  • Fix duplicated error checks
  • Limited fields now reuse destiantion registers if possible.
  • Add (generated) tests.

Removes output changes from 1.5.0 (tested against larger codebase)

* Read header before decoding (effectively unrolls reads)
* Fix duplicated error checks
* Limited fields now reuse destiantion registers if possible.
* Add (generated) tests.

Removes output changes from 1.5.0 (tested against larger codebase)
@philhofer
Copy link
Member

This might be simpler implemented as a msgp library feature, e.g. msgp.ReadBytesLimit, just to keep the complexity of the codegen in check. I don't think there will be much (if any) perf difference.

@klauspost
Copy link
Collaborator Author

@philhofer Yeah. It would also make it possible to "early reject" data that is too big for 32 bit platforms.

Since it only affects "new code" with the limit being set I didn't go too hard on the "make it nice" yet. But the reduction in output code would likely be a good thing.

@klauspost
Copy link
Collaborator Author

Managed to simplify it a bit, removing some needless extra cases.

@klauspost klauspost merged commit 0146c03 into tinylib:master Nov 26, 2025
4 checks passed
@klauspost klauspost deleted the limits-combo branch November 26, 2025 09:09
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.

2 participants