-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[#noissue] Replace HashSet with Eclipse Collections IntSet to optimize primitive int handling #13306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e primitive int handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the codebase to use Eclipse Collections' primitive int collections (IntSet, MutableIntSet) instead of standard Java collections (HashSet, Set) and Guava's ImmutableSet for handling service type codes. This optimization eliminates boxing overhead when working with primitive integer values. The PR also removes an unused annotation key ("nimm.url") from the hardcoded list in RpcURLPatternFilter.
Changes:
- Replaced
HashSet<Short>withMutableIntSetin ApplicationNameMapper for collecting unique service type codes - Replaced
Set<Integer>andImmutableSetwithIntSetandMutableIntSetin RpcURLPatternFilter for managing RPC endpoint annotation codes - Removed the unused "nimm.url" annotation key from RpcURLPatternFilter's initialization
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| web/src/main/java/com/navercorp/pinpoint/web/mapper/ApplicationNameMapper.java | Migrated from HashSet to Eclipse Collections MutableIntSet for deduplicating service type codes; changed serviceTypeCode variable type from short to int to align with IntSet and ApplicationFactory API |
| web/src/main/java/com/navercorp/pinpoint/web/filter/RpcURLPatternFilter.java | Replaced Guava ImmutableSet and HashSet with Eclipse Collections IntSet for storing RPC endpoint annotation codes; removed unused "nimm.url" annotation key from hardcoded list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| MutableIntSet uniqueTypeCodes = IntSets.mutable.of(); | ||
| String applicationName = CellUtils.rowToString(result); | ||
|
|
||
| Cell[] rawCells = result.rawCells(); | ||
| for (Cell cell : rawCells) { | ||
| short serviceTypeCode = CellUtils.valueToShort(cell); | ||
| int serviceTypeCode = CellUtils.valueToShort(cell); | ||
| uniqueTypeCodes.add(serviceTypeCode); | ||
| } | ||
|
|
||
| List<Application> applicationList = new ArrayList<>(); | ||
| for (short serviceTypeCode : uniqueTypeCodes) { | ||
| uniqueTypeCodes.forEach(serviceTypeCode -> { | ||
| final Application application = applicationFactory.createApplication(applicationName, serviceTypeCode); | ||
| applicationList.add(application); | ||
| } | ||
| }); |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refactored logic for collecting unique service type codes using Eclipse Collections IntSet lacks test coverage. Consider adding tests to verify that duplicate service type codes are correctly deduplicated and that the forEach iteration produces the expected Application instances. This is especially important given the change from a traditional for-each loop to a lambda-based forEach method.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #13306 +/- ##
=========================================
Coverage 33.23% 33.24%
- Complexity 10977 10980 +3
=========================================
Files 4070 4070
Lines 94448 94448
Branches 9835 9834 -1
=========================================
+ Hits 31392 31398 +6
+ Misses 60378 60374 -4
+ Partials 2678 2676 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…e primitive int handling
This pull request refactors parts of the codebase to use Eclipse Collections' primitive collections for improved performance and memory efficiency, replacing standard Java collections and Guava's ImmutableSet. It also removes an unused annotation key and updates type handling for service type codes.
Collection Refactoring and Type Handling:
Set<Integer>andSet<Short>(including Guava'sImmutableSetand Java'sHashSet) with Eclipse Collections'IntSetandMutableIntSetinRpcURLPatternFilterandApplicationNameMapperfor more efficient primitive collection handling. [1] [2] [3] [4] [5] [6] [7]serviceTypeCodefromshorttointinApplicationNameMapperto align with the new primitive collection usage.Code Cleanup:
"nimm.url"annotation key from the hardcoded list inRpcURLPatternFilter.