perf: Refactored sorting to use optimized sort algorithms#2161
Merged
zeitlinger merged 2 commits intoJun 1, 2026
Conversation
Signed-off-by: dhoard <doug.hoard@gmail.com>
zeitlinger
reviewed
May 29, 2026
Member
zeitlinger
left a comment
There was a problem hiding this comment.
Great - only wonder if this could be re-usable. Either generics or generating code code.
| * <p>Uses 3-way quicksort partitioning for large ranges, insertion sort for tiny ranges, and a | ||
| * heapsort fallback at the recursion-depth limit to guarantee O(n log n) worst-case complexity. | ||
| */ | ||
| private static final class StringArraySorter { |
Member
There was a problem hiding this comment.
looks pretty similar to last sorter - can we use generics or would this break perf?
Collaborator
Author
There was a problem hiding this comment.
Most likely. I chose to keep the code isolated like the Bubble sort implementation.
zeitlinger
approved these changes
Jun 1, 2026
zeitlinger
added a commit
that referenced
this pull request
Jun 3, 2026
🤖 I have created a release *beep* *boop* --- ## [1.7.0](v1.6.1...v1.7.0) (2026-06-03) ### Features * Add StableApi marker and API diff check ([#2168](#2168)) ([768fd3a](768fd3a)) * add typed metric family descriptors ([#2114](#2114)) ([9c3b097](9c3b097)) * track api-diff baseline via Renovate and store diffs in docs/apidiffs ([#2174](#2174)) ([3adb890](3adb890)) ### Bug Fixes * **deps:** update dependency com.github.ben-manes.caffeine:caffeine to v3.2.4 ([#2088](#2088)) ([144eb61](144eb61)) * **deps:** update dependency io.dropwizard.metrics:metrics-core to v4.2.39 ([#2139](#2139)) ([5817d13](5817d13)) * **deps:** update dependency io.dropwizard.metrics5:metrics-core to v5.0.7 ([#2140](#2140)) ([261c451](261c451)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.0-alpha ([#2126](#2126)) ([b62b5d0](b62b5d0)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.0-alpha ([#2127](#2127)) ([e11ce3d](e11ce3d)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.1-alpha ([#2132](#2132)) ([b09be38](b09be38)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.1-alpha ([#2133](#2133)) ([a241c16](a241c16)) * **deps:** update dependency org.apache.tomcat.embed:tomcat-embed-core to v11.0.22 ([#2099](#2099)) ([22125c5](22125c5)) * **deps:** update jetty monorepo to v12.1.10 ([#2169](#2169)) ([ddd3991](ddd3991)) * **deps:** update jetty monorepo to v12.1.9 ([#2102](#2102)) ([04bee70](04bee70)) * **deps:** update protobuf ([#2129](#2129)) ([320538a](320538a)) * Reduce allocations for classic histogram buckets ([#2081](#2081)) ([edd160a](edd160a)) * restore legacy suffix compatibility ([#2100](#2100)) ([b2ae70f](b2ae70f)) * restore reserved suffix stripping in `PrometheusNaming.sanitizeMetricName()` ([#2124](#2124)) ([2d0f508](2d0f508)) ### Performance Improvements * Refactored sorting to use optimized sort algorithms ([#2161](#2161)) ([25b94fc](25b94fc)) ### Documentation * clarify downstream adapter validation requirements ([#2101](#2101)) ([ef8c75c](ef8c75c)) * Document OM2 ([#2059](#2059)) ([45d753c](45d753c)) * document PushGateway shading workaround ([#2106](#2106)) ([8ca0eb8](8ca0eb8)) --- > [!IMPORTANT] > Close and reopen this PR to trigger CI checks. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactored code to use optimized sort algorithms.