Repository navigation
Conversation
This was referenced Nov 14, 2026
…s the one the seven-call path writes (refs #388) The first test counts the calls on proxies of the source and target vertex, the database and GraphCalls: the parent makes seven calls on the Java objects and none on GraphCalls.newEdge. The others compare the edge with one written by the former code (reproduced in the test) for the three forms of target, edges with and without properties, a source read before other commits, and failures. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rossing, through GraphCalls.newEdge (refs #388) The lookup of the source by record id inside the active transaction and the target's identity were seven JPype calls (getIdentity, isValid, lookupByRID, asVertex, getIdentity, isValid, newEdge). GraphCalls.newEdge does the same steps in Java, with the same rules: a source with a valid identity and a database is looked up again, the target goes in as its identity when that is valid. The wheel carries its own bridge jar, so the seven-call route is gone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…in and commit), and edge lists are read through a fresh vertex (refs #388) The tagged 26.11.1 JVM run failed three tests in every leg, all in tests/test_vertex_new_edge_crossings.py, and all three are the tests, not the new code: - test_new_edge_is_one_call_into_the_bridge put a counting proxy in place of db._java_db before opening the transaction, and the transaction's own begin goes through DbCalls.stackMark(db), which JPype refuses for a proxy ("No matching overloads found"). The proxies are now on only around the new_edge call. - test_the_edge_is_the_one_the_seven_call_path_writes and test_an_edge_without_properties_and_several_edges_of_one_vertex listed the edges of vertex objects read before the commit. A vertex object is the state it had when it was read: GraphEngine.getMostUpdatedVertex (26.11.1) hands it the newest record only inside the transaction that wrote it, so a stale object lists nothing (the same for the seven-call path, and the new_edge docstring says the object is not refreshed). The lists are read through a fresh lookup, and one assertion pins that the stale object is left as it was on both routes. The code is unchanged: the properties, the edge class and the failure parity assertions of the same file passed in all legs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tae898
force-pushed
the
perf/388-residual-jvm-new-edge
branch
from
November 20, 2026 04:27
58ce315 to
3673950
Compare
… missing (refs #388) _graph_calls() answers None when the bridge jar is missing, which sends every caller down the plain path (main fixed the same missing check for the reader calls in 84849b5). new_edge called GraphCalls.newEdge without that check and would raise an AttributeError. It now takes GraphCalls.newEdge when the bridge exists and the former seven calls otherwise. The test puts None under the bridge class and compares the edge with the one the bridge writes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What does this PR do?
On the JVM wheel,
Vertex.new_edge()resolved both ends of the edge by record id in Python:getIdentity,isValid,lookupByRIDandasVertexfor the source,getIdentityandisValidfor the target, thennewEdge. That is seven JPype calls for one edge, where the native wheel makes one (#317).Now it is one call to a new method of
GraphCalls(src/java/com/arcadedb/python/GraphCalls.java):The rules are the ones the Python code had, moved into Java. A source with a valid identity is looked up again by it when a database is given, inside the active transaction, so a vertex object read before another edge was committed does not fail with
ConcurrentModificationException(the case oftests/test_stale_vertex_new_edge.py); otherwise it is used as it is. The target goes in as its identity when that is valid, and the engine loads it. Whether the edge is bidirectional is still the edge type's. The property values are converted in Python as before and cross as the varargs. The seven-call route is kept only as the fallback when the bridge jar is missing (_graph_calls()returnsNone), as the other readers of that file do.Related issues
Refs #388 and #315. This is not one of the ten ranked rows of #388: I found it reading the same code for what the ten leave out.
Performance changes
Not measured yet, so no figure here. The change removes crossings, which the test counts, and I have not timed it. The speed claim waits for a timed A/B of a candidate wheel against 26.11.1.post3, as CONTRIBUTING asks.
The figure for that A/B:
Vertex.new_edge(label, target)with no properties and with three properties (a string, an int and a float), for 1, 100 and 10,000 edges between vertices read once, each batch in one transaction, on a vertex type that has one edge type. The unit of one operation is onenew_edgecall, reported per edge. Wheel:arcadedb-jvm. The parity digest covers, for every edge, the property map, the Java class of the edge and the record ids at both ends, read back after the commit. The no-change control isgraph_batch().new_edgesfor the same edges (a path this change does not touch), and an A/A pair.Memory: the change allocates the property list that Python built before (two items per property) and nothing else. No batch or second copy of an input is held.
How I checked it
The tests come first in the first commit and the change in the second, so a run of the first commit shows them failing on the old code.
tests/test_vertex_new_edge_crossings.py(JVM wheel only, listed inNATIVE_NOT_APPLICABLE): one test counts the calls on proxies of the source and target vertex, the database andGraphCallsand expects exactlyGraphCalls.newEdge(the old code makes seven calls on the Java objects and none onGraphCalls). The others compare the edge with one written by the former code, reproduced in the test: properties of six kinds, the Java class of the edge, both ends read back throughget_out_edgesandget_in_edges, the three forms of target (Python vertex, Java vertex, Java RID), edges without properties, a source read before two commits, and the class of the failure for a missing edge type, a value Java cannot take and an unsaved source.test_without_the_bridge_class_new_edge_takes_the_plain_path_and_writes_the_same_edgeputsNoneunder the bridge class and checks thatnew_edgefalls back to the seven calls and writes the same edge.tests/test_stale_vertex_new_edge.py(both wheels) already covers the vertex that was read before other commits.uvx pre-commit run --fileson the changed files, Bandit as CI runs it, pyflakes.CI: to be filled in once the legs have run.
Docs
No page or the README describes how
new_edgecrosses, so none needs an update.Checklist
uvx pre-commit run --files <changed files>passes🤖 Generated with Claude Code