[12] (S) RFR 8206122 : Use Queue in place of ArrayList when need to remove first element

Ivan Gerasimov ivan.gerasimov at oracle.com
Wed Jul 11 00:49:16 UTC 2018


Thank you Jon!


On 7/10/18 4:43 PM, Jonathan Gibbons wrote:
>
> In both files, the imports are messed up.
>
Okay, I can fix it while we're here.

Please find the webrev updated in-place:
http://cr.openjdk.java.net/~igerasim/8206122/01/webrev/

With kind regards,
Ivan

> At a minimum, the new imports should be grouped with existing imports 
> from the same package.
>
> -- Jon
>
>
> On 7/10/18 4:38 PM, Ivan Gerasimov wrote:
>>
>> Thank you Martin!
>>
>>
>> On 7/10/18 2:32 PM, Martin Buchholz wrote:
>>> I'm happy to see ArrayDeque replacing uses of ArrayList.
>>>
>>> private final Map<List<String>, Deque<ReusableContext>> 
>>> options2Contexts = new HashMap<>();
>>> Looks like these Deques are used only via the Queue interface. I 
>>> would either switch to Queue or to ArrayDeque (which might help the 
>>> VM optimize).
>>
>> Right.
>> I can't remember why I used Deque in one place and Queue in the other.
>>
>> Please find the updated webrev here:
>> http://cr.openjdk.java.net/~igerasim/8206122/01/webrev/
>>
>> With kind regards,
>> Ivan
>>
>>>
>>> On Tue, Jul 10, 2018 at 1:54 PM, Ivan Gerasimov 
>>> <ivan.gerasimov at oracle.com <mailto:ivan.gerasimov at oracle.com>> wrote:
>>>
>>>     Hello!
>>>
>>>     It is a tiny optimization.
>>>
>>>     There are a couple of places where ArrayList is used as FIFO:
>>>     elements are appended to the end, and removed from the head.
>>>
>>>     ArrayDeque would be more efficient to use.
>>>
>>>     Would you please help review?
>>>
>>>     BUG: https://bugs.openjdk.java.net/browse/JDK-8206122
>>>     <https://bugs.openjdk.java.net/browse/JDK-8206122>
>>>
>>>     Webrev: http://cr.openjdk.java.net/~igerasim/8206122/00/webrev/
>>>     <http://cr.openjdk.java.net/%7Eigerasim/8206122/00/webrev/>
>>>
>>>     Thanks in advance!
>>>
>>>     -- 
>>>     With kind regards,
>>>     Ivan Gerasimov
>>>
>>>
>>
>> -- 
>> With kind regards,
>> Ivan Gerasimov
>

-- 
With kind regards,
Ivan Gerasimov

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180710/acd9bcde/attachment.html>


More information about the compiler-dev mailing list