GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JVM read path: fewer crossings per call (get_raw, one, count, lookup_by_key, transaction mark) by tae898 · Pull Request #524 · humemai/arcadedb-embedded-python

This repository was archived by the owner on Nov 21, 2026. It is now read-only.

Conversation

@tae898

@tae898 tae898 commented Oct 25, 2026

Copy link
Copy Markdown

The JVM wheel's read path crossed into the JVM several times per operation; a JPype call is a few microseconds of dispatch, and an untimed async-profiler pass (CPU samples of the Python-driven threads, main wheel) put 10.7% of a warm point-read workload in JNI/libjvm and 5.2% in JPype C++ besides 5.4% of Java glue. This PR cuts the number of crossings of five common calls, each as its own commit, with the answer, the errors and the result-set state unchanged.

What changes (crossings per call, counted by the new tests on a proxy of the Java object and the bridge classes; the tests that count fail on main and pass here)

  • Document.get_raw() (so get(), Vertex.get(), Edge.get()): 2 crossings and 2 scans of the record (has() then get()) become 1 crossing and 1 scan. get() answers null for a property the record does not have, as it does for one set to null, and Python reads None either way; has_property() still tells the two apart (tests for absent, null-valued, mutable, vertex and edge).
  • ResultSet.one(): RowAccess.upToTwoAndClose returns the first two rows and closes the set in one call, where the loop took hasNext()/next() per row plus the close (4 crossings for a single row by reading the code). Zero rows, several rows, an error while reading and a closed database raise the same exceptions and leave the same _closed/_exhausted state as the plain path, which stays for a missing bridge class.
  • ResultSet.count(): RowAccess.countAndClose counts the rows left and drains and closes the set in one call, where the loop crossed twice per row. A statement error surfaces as before and leaves the set open for the caller.
  • Database.lookup_by_key(): it was already one crossing, but built a String[] and an Object[] through JPype first. DbCalls.lookupFirstKey takes one key as scalars and lookupFirstKeys takes any number as the varargs of one call (names then values, so a different number of names and values reaches the engine as before). lookupFirst, which takes the arrays, stays.
  • The transaction-stack mark taken before every begin(): DbCalls.stackMark returns active and nesting depth as one number, so with db.transaction() goes from 4 crossings to 3 and run_in_transaction() from 6 to 5. The mark is still taken before begin(), so the interrupt and refused-begin rules of An interrupt during begin() inside a caller's own transaction leaves the nested transaction on the stack, so the caller's next commit commits an empty level and leaves their work uncommitted ArcadeData/arcadedb#9970, Two Python binding defects closed without a fix: run_in_transaction leaks a transaction and start() does not survive a Ctrl-C ArcadeData/arcadedb#9813 and db.transaction(...) retry re-applies the durable half of a statement that committed mid-execution (BATCH n, TRUNCATE TYPE) ArcadeData/arcadedb#7916 are unchanged.

Tests bindings/python/tests/test_read_crossings.py (21 tests: crossing counts plus equivalence with the plain path, including typed and composite keys, error cases and the engine's own stack numbers). On the main wheel 9 of them fail (the counts) and 12 pass (the equivalence); on this branch's wheel all 21 pass, and so do test_percall_calls, test_resultset, test_resultset_read_errors, test_results_after_close, test_run_in_transaction_retry, test_transaction_context_interrupt, test_transaction_config, test_graph_api, test_core, test_concurrency and test_cross_model_atomicity (232 passed, 10 skipped there). They ran against the main CI wheel with only the changed Python files and a bridge jar rebuilt from these sources. docs/development/bridge.md lists the new entry points.

What was measured and what was not Only untimed crossing counts. No speed claim is made here: a timed ABBA A/B of the main wheel against this branch on the benchmark laptop (point reads, one(), Document.get, small transactions and a 4-thread mixed window, with an A/A control and a rule written before the first timed run) is queued, and this PR is not to be merged on the counts alone. The transaction commit saves one crossing of a few microseconds next to a commit of tens of microseconds, so it may not show; the rule treats it separately.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tae898 and others added 6 commits October 25, 2026 17:00
@tae898 @claude
Test the JVM read path's crossings and its equivalence with the plain…
4c96802
… path

Counts the calls into the JVM of Document.get_raw, ResultSet.one() and count(), lookup_by_key and the transaction-stack mark, and pins that each answer, error and result-set state equals the plain path's. These fail on main: that is the change they ask for.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@tae898 @claude
Document.get_raw: one crossing and one scan of the record instead of …
14f12f8
…has() then get()

get() answers null for a property the record does not have, as it does for one set to null; Python reads None either way, so the has() call only repeated the scan.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@tae898 @claude
ResultSet.one() and count(): one crossing through RowAccess, like fir…
61e364f
…st()

one() read hasNext()/next() per row and closed afterwards; count() crossed twice per row. upToTwoAndClose and countAndClose do the same work Java-side with the same errors and the same result-set state, and the plain path stays for a missing bridge class.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@tae898 @claude
lookup_by_key: the key names and values cross as scalars or varargs, …
cecd7ad
…no Java arrays

DbCalls.lookupFirstKey takes one key as scalars and lookupFirstKeys takes any number as the varargs of one call, so neither side builds a String[] and an Object[] per lookup. The engine receives the same arrays, and a different number of names and values reaches it as before.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@tae898 @claude
Transaction-stack mark in one crossing
a877204
The mark taken before every begin() (with db.transaction(), run_in_transaction) asked isTransactionActive() and getNestedTransactions() separately. DbCalls.stackMark returns both as one number. The mark is still taken before begin(), so the interrupt and refused-begin rules of ArcadeData#9970 and ArcadeData#9813 are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@tae898 @claude
bridge.md: the new RowAccess and DbCalls entry points
8224a85
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Oct 25, 2026
find_nearest: merge the bucket hits by score, then load only the final k (JVM, B-01) #534
Closed
Bindings: more positional values than placeholders is a TypeError, not a silently dropped value (P-07) #536
Merged
Native: more positional values than placeholders is a TypeError, not a silently dropped value (P-07) #537
Closed
@tae898

tae898 commented Oct 26, 2026

Copy link
Copy Markdown
Author

Closing here: the bindings moved to ArcadeData/arcadedb-python. The branch stays for the queued A/B jvm-readpath-glue-ab-laptop-20261025; if it passes, the change is ported there.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tae898 tae898 closed this Oct 26, 2026
This was referenced Nov 3, 2026
JVM wheel: the read path crosses into the JVM more often than it needs to (get_raw, one, count, lookup_by_key, transaction mark) ArcadeData/arcadedb-python#213
Closed
JVM read path: fewer crossings per call (get_raw, one, count, lookup_by_key, transaction mark) ArcadeData/arcadedb-python#214
Merged
@tae898
tae898 deleted the perf/jvm-read-crossings branch November 8, 2026 11:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@tae898
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.