Review Request JDK-8192945: Need stable sort for MODULES entry in the release file

Claes Redestad claes.redestad at oracle.com
Wed Dec 6 17:16:15 UTC 2017


Hi

On 2017-12-06 17:28, mandy chung wrote:
> Updated webrev:
> http://cr.openjdk.java.net/~mchung/jdk10/webrevs/8192945/webrev.01/

looks good, but... :-)

>
> I kept the nodes as a Deque as it polls one node for traversal.

Does it have to, though? 'nodes' is a local variable, so polling versus 
iterating
doesn't matter here. So it seems:

          ResourcePoolModule node;
          while ((node = nodes.poll()) != null) {
              if (!visited.contains(node)) {
                  visit(node, visited, done);
              }
          }

... could be replaced with:

          for (ResourcePoolModule node : nodes) {
              if (!visited.contains(node)) {
                  visit(node, visited, done);
              }
          }

Together with Andrej's suggestion for simplifying creation of nodes as
an ArrayList directly this would make the code cleaner and faster.

While I agree this isn't too critical from a performance point of view,
hotspot devs building slowdebug regularly comment on how long time
jlinking the JDK images take, so we shouldn't frown too hard at
opportunities to speed things up (even though this likely doesn't matter
much on its own...)

Thanks!

/Claes


More information about the jigsaw-dev mailing list