RFR: Here are some URLClassPath patches

Martin Buchholz martinrb at google.com
Mon Feb 26 21:25:57 UTC 2018


On Mon, Feb 26, 2018 at 9:28 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:

>
>
> > On Feb 23, 2018, at 2:09 PM, Martin Buchholz <martinrb at google.com>
> wrote:
> >
> > [+Paul]
> >
> > On Fri, Feb 23, 2018 at 6:28 AM, Alan Bateman <Alan.Bateman at oracle.com>
> wrote:
> >>
> >> 8198484: URLClassPath should use an ArrayDeque instead of a Stack
> >> http://cr.openjdk.java.net/~martin/webrevs/jdk/URLClassPath-ArrayDeque/
> >> https://bugs.openjdk.java.net/browse/JDK-8198484
> > Can copyToArrayDeque use addAll?
> >
>
>
> > On Feb 23, 2018, at 2:09 PM, Martin Buchholz <martinrb at google.com>
> wrote:
>
> > Not directly, because addAll uses a lambda, and it's too early in the
> bootstrap for lambdas.
> >
> > We could delambdafy ArrayDeque, plausibly because ArrayDeque is a
> super-core class, perhaps reengineering ArrayDeque(Collection) and/or
> addAll(Collection).
> >
>
> Some data on how many lambdas/methods refs are used by the core collection
> classes could help. I would be wary of going on a lambda purge right now
> and biasing certain collection classes towards their use at startup if we
> can avoid that with careful management.
>
> I would be tempted to drop the method copyToArrayDeque and just rely on
> the push method (even though it uses synchronized), then add a comment to
> the unopenedUrls field and/or in the constructor.
>
>
I prefer to keep things as I have them for now.  Calling push requires an
extra copy to create the array, and even though that overhead is swamped by
other inefficiencies, it's a tax on every single java program (and the tax
is higher at Google, where we have trouble fitting the classpath into
Linux' 128 kb per-arg command line length limit).


More information about the core-libs-dev mailing list