RFR: 8360023: Add an insertion sort implementation to Hotspot [v3]
Quan Anh Mai
qamai at openjdk.org
Thu Jun 19 15:52:27 UTC 2025
On Thu, 19 Jun 2025 15:28:02 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:
> These many years of the project, there have not been any needs for a stable sort.
Just do a `grep -rn ./src/hotspot -e "stable sort"` you can find:
https://github.com/openjdk/jdk/blob/c4fb00a7be51c7a05a29d3d57d787feb5c698ddf/src/hotspot/share/classfile/fieldLayoutBuilder.hpp#L106
> If you want the insertion sort, I'd recommend to have it in `GrowableArrayView`: `GrowableArrayView<>::insertion_sort()`.
We are programming in C++, I think it would be better to follow the C++ convention. The practical reason is that it prevents users not wanting to sort from having to include the sort functionality.
> In this case you will not have the issue with iterators names which is a big issue from my point of view.
Now we have `GrowableArrayIterator` and `GrowableArrayNonConstIterator`, what is the issue with them?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25895#issuecomment-2988548565
More information about the hotspot-dev
mailing list