Repository navigation
native: skip the decode hook when a reply holds no tagged value - #152
Merged
Merged
Conversation
codec.loads ran json.loads(text, object_hook=_hook), a Python call per decoded object, for every reply. NativeCodec.quote escapes every character below 0x20, so a tagged value always puts the escaped tag in the text; when it is absent the hook changes nothing and is skipped. Untimed micro-benchmark: 2.315 -> 1.329 us for a one-row reply. A string or key containing U+0001 still takes the hook path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #151
codec.loadsnow returnsjson.loads(text)when the reply text does not contain the escaped tag\u0001, and keeps the hook path otherwise.NativeCodec.quoteescapes every character below 0x20, so a tagged value always puts that escape in the text: the shortcut can never skip a tagged value. A false positive (a string or a key that merely contains U+0001) only takes the existing hook path.Measurements are in #151 (untimed micro-benchmark on the laptop measurement lane): about 1 us less per one-row reply, 2.315 us with the hook against 1.329 us without. Who it serves: users of the default
arcadedb(native) package doing point and small range reads. No API change.Tests (
tests/test_native_codec_loads.py, pure codec, no database):loadsalways calls_hook);The end-to-end transport tests (
test_native_result_transport.pyand the rest of the suite) run on every leg in CI.🤖 Generated with Claude Code