Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8225239

Refactor NetworkInterface lookups

XMLWordPrintable

    • b05

      JDK-8223214 changed logic around to cause a slight increase in classes loaded when calling InetAddress.getLoopbackAddress(), which can be linked to a tiny footprint increase in 13-b22 since these classes end up in the default CDS archive.

      We can recuperate slightly by arranging so that we don't load Inet4AddressImpl unnecessarily from Inet4AddressImpl etc.

      A related inefficiency is that the call to NetworkInterface.getByInetAddress is inefficient since it enumerates and loops over all IPv4 and IPv6 interfaces, regardless of the type of address we're looking up. This is pre-existing, but JDK-8223214 puts it up there. How costly this superfluous enumeration is depends on the system you're on and it's network configuration, but I get a small improvement (~0.1ms) on startup from a patch that only searches the relevant interfaces.

            redestad Claes Redestad
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: