JDK-7119269 : Tune URLUtils
  • Type: Bug
  • Component: deploy
  • Sub-Component: deployment_toolkit
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-12-08
  • Updated: 2012-05-30
  • Resolved: 2011-12-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
6u33Fixed 7u4Fixed 8 b18Fixed
Related Reports
Relates :  
Relates :  
Spin of from 7118421. 

Basic operations to compare URLs are not implemented efficiently as
  a) they may still end up in DNS lookups
  b) use case sensitive comparison when it is not needed
  c) compare parts that often the same first (e.g. protocols)

JarDesc is often used in lists and maps but its equals/hashcode perform a lot of computations.

DeployClassLoader relies on ArrayList.contains() but this will use URL.equals() and result in DNS calls.

All this is results in slow down, especially if some DNS is slow of URLs are not valid.
(e.g. when launch from cache and being offline or behind firewall)

EVALUATION Added some tweaks to avoid DNS lookups and improve performance of URLUtil/JarDesc. For artificial stress test with non existing URLs (see comments) it helps to improve performance from ~75 sec to create class loader with 10000 URLs that can not be resolved by DNS (and my DNS is slow in the VPN) ~2.2 sec to lookup 5000 JarDesc from the class loader based on URLs to ~1.8s to create class loader ~1.2s for lookups These numbers are just for illustration only as test used is not accurate benchmark and heavily depends on DNS performance.