Skip to content

Conversation

@viliam-durina
Copy link
Contributor

@viliam-durina viliam-durina commented Jan 16, 2026

In two instances, FixedBitSet.ensureCapacity() was called right before the bitset was cleared. This unnecessarily copied the internal array.

This PR adds FixedBitSet.ensureCapacityAndClear() that avoids the copying. This should give a small performance improvement.

Also rename numBits to desiredBit - the argument didn't specify the number of bits we want to store, but the desired index we wanted to store at. This allowed for a much simpler javadoc that's not self-contradictory.

In two instances, `FixedBitSet.ensureCapacity()` was called right before the bitset was cleared. This unnecessarily copied the internal array.

This PR adds `FixedBitSet.ensureCapacityAndClear()` that avoids the copying. This should give a small performance improvement.
@github-actions github-actions bot added this to the 11.0.0 milestone Jan 16, 2026
@dweiss dweiss merged commit 59df9e7 into apache:main Jan 16, 2026
12 checks passed
@viliam-durina viliam-durina deleted the bitset-dont-copy branch January 16, 2026 15:40
@viliam-durina
Copy link
Contributor Author

Should we backport this to 10.x?

@dweiss
Copy link
Contributor

dweiss commented Jan 16, 2026

We can but it'd require moving the changes entry under 10x.

dweiss added a commit that referenced this pull request Jan 19, 2026
dweiss pushed a commit that referenced this pull request Jan 19, 2026
@dweiss dweiss modified the milestones: 11.0.0, 10.4.0 Jan 19, 2026
@dweiss
Copy link
Contributor

dweiss commented Jan 19, 2026

I've backported and updated changes.txt accordingly.

@viliam-durina
Copy link
Contributor Author

I've backported and updated changes.txt accordingly.

Thanks, was just about to do it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants