Update Transaction API getCommittedVersion To Avoid Autoboxing
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 126
Description
The `Long getCommittedVersion()` has an overhead of Autoboxing the primitive `long` value to a `Long` object. It's not clear to me the use case for this return value - the JavaDoc do not comment on what a 'null' value returned would indicate.
https://github.com/apple/foundationdb/blob/280b10fa4954e95d18e8ac2f93f520b8822ed2c0/bindings/java/src/main/com/apple/foundationdb/Transaction.java#L244-L254
It looks like the source for this data is primitive already:
https://github.com/apple/foundationdb/blob/280b10fa4954e95d18e8ac2f93f520b8822ed2c0/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java#L648
Please consider adding a new method with a primitive return type to avoid this overhead.
I happened to come across this when reviewing an application that had churned 9GB of Long values in heap in ~30min - certainly not the end of the world, but something to flag. Thanks.
Contributor guide
Research direction
Start by reading the getCommittedVersion declaration in bindings/java/src/main/com/apple/foundationdb/Transaction.java and the corresponding implementation in bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java. Clarify what a null result means, then determine the Java binding API and coverage changes needed for a primitive-returning alternative; done means the behavior and return-value contract are documented and verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100