On Wed, 12 Aug 2026 14:54:19 GMT, Daisuke Yamazaki <[email protected]> wrote:

>> Added a fast path for `PriorityQueue#addAll` when adding elements to an 
>> empty, exact `PriorityQueue` instance.
>> 
>> Instead of inserting each element one by one through `AbstractQueue#addAll`,
>> the implementation now copies the source collection into the backing array 
>> and calls `heapify()`.
>> This reduces the construction cost for bulk insertion into an empty queue 
>> from repeated per-element sift-up work to linear-time heap construction.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Daisuke Yamazaki has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Add checks for non-Comparable elements

Thank you for your patience.
After thinking about this for a bit, I unfortunately must conclude that I think 
that the added complexity to address a slim subset of operations (adding a 
collection to an empty priority queue) is not a worthwhile trade-off.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/31701#issuecomment-6266992033

Reply via email to