You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "merlimat (via GitHub)" <gi...@apache.org> on 2026/03/27 15:59:45 UTC

[PR] Remove fastutil dependency (~21MB jar) [pulsar]

merlimat opened a new pull request, #25413:
URL: https://github.com/apache/pulsar/pull/25413

   ## Summary
   
   - Replace fastutil collections with minimal open-addressing hash map/set implementations in `pulsar-common` using the same approach (primitive keys, Fibonacci hashing, backward-shift deletion)
   - Replace fastutil pair types (`IntIntPair`, `ObjectIntPair`) with Java records
   - Use `java.util.TreeMap` directly for sorted maps instead of fastutil's `Long2ObjectAVLTreeMap`/`Long2ObjectRBTreeMap`
   - Remove the `pulsar-client-dependencies-minimized` module and all fastutil shading/relocation configuration
   
   New classes in `org.apache.pulsar.common.util.collections`:
   - `Long2ObjectOpenHashMap`, `Long2IntOpenHashMap`, `Int2ObjectOpenHashMap`
   - `LongOpenHashSet`, `IntOpenHashSet`
   - `IntIntPair`, `ObjectIntPair` (records)
   - `Long2ObjectMap`, `Long2IntMap` (interfaces)
   - `LongObjConsumer` (functional interface)
   
   Migrated 7 files across `pulsar-broker` and `pulsar-client`:
   - `DrainingHashesTracker`, `PersistentStickyKeyDispatcherMultipleConsumers`
   - `Consumer`, `InMemoryRedeliveryTracker`, `PendingAcksMap`
   - `InMemoryDelayedDeliveryTracker`, `NegativeAcksTracker`
   
   ## Motivation
   
   Fastutil is a ~21MB jar but Pulsar only uses a handful of its classes (maps, sets, and pairs) in 7 files. The custom implementations are minimal, only covering the operations actually used, and follow the same open-addressing design to preserve performance characteristics.
   
   ## Documentation
   - [x] `doc-not-needed`
   
   ## Matching PR in forked repository
   
   _No_
   
   ## Test plan
   - [x] Unit tests added for all new collection classes (`Long2ObjectOpenHashMapTest`, `Long2IntOpenHashMapTest`, `Int2ObjectOpenHashMapTest`, `HashSetTest`)
   - [ ] Verify existing broker and client tests pass with the new implementations
   - [ ] `ready-to-test`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [cleanup] Remove fastutil dependency [pulsar]

Posted by "merlimat (via GitHub)" <gi...@apache.org>.
merlimat merged PR #25413:
URL: https://github.com/apache/pulsar/pull/25413


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org