Visitar URL original
bindings: fewer JPype crossings on a short read (one nextRows call, scalar parameters without the conversion walk) (#213) by tae898 · Pull Request #214 · humemai/arcadedb-embedded-python · GitHub
Skip to content

bindings: fewer JPype crossings on a short read (one nextRows call, scalar parameters without the conversion walk) (#213) - #214

Merged
tae898 merged 3 commits into
mainfrom
levers-bindings-call-overhead
Oct 6, 2026
Merged

tae898 merged 3 commits into
mainfrom
levers-bindings-call-overhead

Conversation

@tae898

@tae898 tae898 commented Oct 6, 2026

Copy link
Copy Markdown

Fixes #213.

RowAccess.nextRows and RowBatcher.nextJsonBatch return fewer rows than asked for only when the result set is drained, so they now close it before returning and Python stops after a short batch: to_list() no longer asks a second time for an empty batch (the same extra crossing #144 removed from to_json_list()), and a drained result set no longer costs one more crossing for close(). Scalar parameters (a dict of str keys with exact int, float, str, bool, or None values, or positional scalars) become a HashMap or an Object[] directly; numpy scalars, Decimal, dates, lists, and subclasses of int keep the general path.

Measured on the official 26.10.1 jars, interleaved, 13 runs per arm, ratios only (a laptop shared with other jobs): a documents SELECT by key through to_list() 0.83x [0.80, 0.89], p=0.0003; _java_parameters 0.79x for one key and 0.78x for three positional values, p<0.0001. The bound Cypher read through to_json_list() is 0.92x [0.81, 1.06], not significant. No detectable effect on a whole new-order or payment transaction.

Tests: counting stand-ins show one nextRows and one nextJsonBatch for a short result and two for an exact batch; a JPype proxy shows the bridge closes what it drains and leaves a result with rows alone; a spy on convert_python_to_java sees no call for scalar parameters and the answers are the same for every scalar type; the RID-paging tests (arcadedb ArcadeData#8594) still finish. The full bindings suite on the official 26.10.1 jars gave 815 passed, 3 skipped, 9 xfailed before #208 removed the skips.

Do not merge before the 26.10.1 release is pushed to main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi

tae898 and others added 3 commits October 6, 2026 15:45
… closes the drained result set (to_list no longer asks twice)

RowAccess.nextRows and RowBatcher.nextJsonBatch return fewer rows than asked for only when the result set is drained, so they now close it before returning, and Python stops after a short batch: to_list() made a second nextRows call just to see an empty batch (the same extra crossing #144 removed from to_json_list()), and every drained result set cost one more crossing for close(). A JPype call is 3 to 4 microseconds, a fifth of a one-row read.

Measured on the benchmark's own read shapes (src/ab_reads.py, official 26.10.1 jars, interleaved A/B, 13 runs per arm, cores 6-7 of a laptop shared with other jobs, every run flagged by the throttle and swap-in checks, so ratios only): the documents lane's SELECT by key through to_list() 0.83x [0.80, 0.89], p=0.0003; the same read through first().get() 0.90x. The l2 bound Cypher read through to_json_list() 0.92x [0.81, 1.06], p=0.38: not significant at 13 runs.

Tests: counting stand-ins for the bridge classes show one nextRows and one nextJsonBatch for a short result, two for an exact batch; a JPype proxy of the Java ResultSet shows the bridge closes what it drains and leaves a result with rows alone; Python makes no close() call; the RID-paging tests (arcadedb ArcadeData#8594) still finish. Four of the nine new tests fail on the old code. Full bindings suite on the official 26.10.1 jars with the two changes of this branch: 815 passed, 3 skipped, 9 xfailed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi
…n walk

A dict of str keys whose values are plain scalars (int, float, str, bool, None, exact types), or positional scalars, now becomes a HashMap or an Object[] directly. JPype boxes them exactly as the general path boxed its unchanged values; numpy scalars, Decimal, dates, lists and subclasses of int keep the general path. Database._java_parameters cost 6.5 us for a one-key dict and 7.2 us for three positional values; it is 5.0 and 5.6 now (0.79x and 0.78x, 13 interleaved runs per arm, p<0.0001), on statements that are 15 to 60 us in all.

Tests: a spy on convert_python_to_java sees no call for scalar parameters (the dict test fails on the old code), the same answers for every scalar type including 2**40 and null, and the general path is still taken for Decimal, lists, int subclasses and numpy scalars. Full bindings suite: 815 passed, 3 skipped, 9 xfailed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi
@tae898
tae898 merged commit fabbda7 into main Oct 6, 2026
26 of 29 checks passed
@tae898
tae898 deleted the levers-bindings-call-overhead branch October 6, 2026 09:56
tae898 added a commit that referenced this pull request Oct 6, 2026
The bindings 26.10.1 release (629b242), #214 (fewer JPype crossings on a short read: RowAccess.nextRows and RowBatcher.nextJsonBatch, scalar
parameters bound without the conversion walk), #216 (docs, CI summary, scripts), the pruned foreign .github file, and upstream engine syncs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi
tae898 added a commit that referenced this pull request Oct 6, 2026
…of bindings #214; row 63 names the wheel by the tree it is built from

Bindings #214 (fewer JPype crossings on a short read, scalar parameters bound without the conversion walk) landed on main after the
re-pin wheel was first built, and the bindings 26.10.1 release was cut before it and before the columnar insert. The wheel the stages
bake is therefore a laptop build from this tree over the official jars, version 26.10.1, rebuilt after the merge of origin/main
(abd7319): row 74 records what it carries, its size and sha256, the commit it was built from, that it is not the PyPI file, and that
the re-pin's ArcadeDB embedded rows are not comparable with October's at the call-overhead level.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ubz3m6QXHESerCkehC1qgi
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.

bindings: fewer JPype crossings on a short read (one nextRows call, scalar parameters without the conversion walk)

1 participant