Specialized row decoders per type - #48
Draft
mzabani wants to merge 22 commits into
Draft
Conversation
mzabani
force-pushed
the
cps-parser-fewer-bytestrings
branch
from
August 23, 2026 13:29
e9d01e1 to
253fbd7
Compare
We're beginning to converge to row decoders not being inlined by default, but their implementations/bodies being as inlined as possible, which feels reasonable. It remains to be seen if we can add a super-inlined version of row decoders for users to choose from if they wish, and what the effects are.
The boundary here is very nice: users that want to avoid too much code bloat can use the non-inlined decoders, and those that want to max out performance can use the inlined decoders.
With this, I am able to write specialised `FromPgField (Maybe a)` instances that can inline more aggressively. The gotcha is
Let's see if this is better than the OVERLAPPING instances
This is the prize I was looking for. Now the row decoders are built with the NULL handling parts a lot more inlined, which even means in a fully inlined row decoder we no longer box into a `Maybe a` to then case match on it and fail on `Nothing`, when the target record has a field typed as `a` (not a Maybe).
Types like `Scientific` are not being decoded optimally otherwise, and they can do better than in the current state
Becase we don't have a FieldInfo when decoding NULL anymore. Not sure what we can do.
mzabani
force-pushed
the
specialized-row-decoders-per-type
branch
from
August 23, 2026 15:16
7eddecb to
4861e73
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3 of perf optimizations. This has technically breaking API changes (but most users shouldn't be affected and it's easy to adapt to the changes) and still needs a lot of thinking before being merged.
Before merging:
instance FromPgField MyEnum's definition, and see that users have no way of usingfailwithrawBytesFieldDecoder. Maybe something to keep in mind in any form of API changes.