◐ Shell
reader mode source ↗
Skip to content

Iterator performance#270

Draft
stroomdev66 wants to merge 77 commits into
masterfrom
iterator-performance
Draft

Iterator performance#270
stroomdev66 wants to merge 77 commits into
masterfrom
iterator-performance

Conversation

@stroomdev66

@stroomdev66 stroomdev66 commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator

This is just a draft for now to show iterator performance improvements when using specific classes for cursor direction etc and removing the state machine approach.

Closes gh-269

at055612 and others added 27 commits March 6, 2025 16:04
There are now essentially three ways of configuring comparators
when creating a Dbi.

**null comparator**
LMDB will use its own comparator & CursorIterable will call down
to mdb_cmp for comparisons between the current cursor key and the
range start/stop key.

**provided comparator**
LMDB will use its own comparator & CursorIterable will use the
provided comparator for comparisons between the current cursor
key and the range start/stop key.

**provided comparator with nativeCb==true**
LMDB will call back to java for all comparator duties.
CursorIterable will use the same provided comparator for
comparisons between the current cursor key and the range
start/stop key.

The methods `getSignedComparator()` and `getUnsignedComparator()`
have been made public so users of this library can access them.
Refactor DbiBuilder and Dbi ctor to use DbiFlagSet.
Replace Env#copy(File, CopyFlags...) with copy(File, CopyFlagSet).
As there is only one flag this should not be a breaking change.

Deprecate Env#txn(Txn, TxnFlags...) as there is now
Env#txn(Txn)
Env#txn(Txn, TxnFlags)
Env#txn(Txn, TxnFlagSet)
Also improve javadoc and refactor some tests to use DbiBuilder.

Some tests are failing.
@stroomdev66

Copy link
Copy Markdown
Collaborator Author

This is just a draft for discussion. If the approach is accepted then the current iterator would be replaced to maintain API compatability.

@codecov

codecov Bot commented Nov 4, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.86184% with 334 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.31%. Comparing base (65df2ee) to head (9541da3).
⚠️ Report is 106 commits behind head on master.

Files with missing lines Patch % Lines
src/main/java/org/lmdbjava/DirectBufferProxy.java 25.42% 42 Missing and 2 partials ⚠️
src/main/java/org/lmdbjava/Env.java 52.68% 38 Missing and 6 partials ⚠️
src/main/java/org/lmdbjava/Dbi.java 56.97% 31 Missing and 6 partials ⚠️
src/main/java/org/lmdbjava/KeyRange.java 68.68% 31 Missing ⚠️
src/main/java/org/lmdbjava/ByteBufferProxy.java 54.83% 18 Missing and 10 partials ⚠️
src/main/java/org/lmdbjava/LmdbIterable.java 82.87% 17 Missing and 8 partials ⚠️
src/main/java/org/lmdbjava/ByteArrayProxy.java 4.34% 22 Missing ⚠️
src/main/java/org/lmdbjava/ByteBufProxy.java 43.58% 18 Missing and 4 partials ⚠️
src/main/java/org/lmdbjava/LmdbStream.java 85.21% 14 Missing and 7 partials ⚠️
src/main/java/org/lmdbjava/Cursor.java 48.14% 8 Missing and 6 partials ⚠️
... and 12 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #270      +/-   ##
============================================
- Coverage     89.06%   81.31%   -7.76%     
- Complexity      413      598     +185     
============================================
  Files            32       57      +25     
  Lines          1482     2531    +1049     
  Branches        125      279     +154     
============================================
+ Hits           1320     2058     +738     
- Misses           92      336     +244     
- Partials         70      137      +67     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

26 hidden items Load more…
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.

Improve iterator performance and add better stream support

3 participants