RFR[8246047]: 'Replace LinkedList impl in net.http.websocket.BuilderImpl'
Conor Cleary
conor.cleary at oracle.com
Fri Aug 14 14:37:36 UTC 2020
Hi all,
Requesting some reviewers for a patch concerning JDK-8246047 'Replace
LinkedList impl in net.http.websocket.BuilderImpl'. This patch replaces
LinkedList data structures used in the net.http.websocket BuilderImpl
class with ArrayLists. In particular, the 'headers' and 'subprotocols'
Collections in the class are now assigned ArrayLists in the BuilderImpl
constructors.
Some justifications for this change are as follows:
* Sequential Access Times for ArrayLists are improved due to locality
of reference (i.e ArrayList elements stored in same neighbourhood)
* Get(index) operations are O(1) time complexity for ArrayLists as
opposed to worst-case O(N-1) for LinkedLists
* While insertion operations can be expensive (O(N) in the worst
case), the 'headers' and 'subprotocols' lists are not modified after
creation and so this is of minor concern
Additional justifications or challenges to them are welcome! The general
idea is that ArrayLists out-perform LinkedLists in this particular scenario.
* webrev:
http://cr.openjdk.java.net/~ccleary/issues/webrevs-store/8246047/webrevs/webrev.02/
* bug: https://bugs.openjdk.java.net/browse/JDK-8246047
Conor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20200814/832a8295/attachment.htm>
More information about the net-dev
mailing list