United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7119269 : Tune URLUtils

Details
Type:
Bug
Submit Date:
2011-12-08
Status:
Resolved
Updated Date:
2012-05-30
Project Name:
JDK
Resolved Date:
2011-12-19
Component:
deploy
OS:
generic
Sub-Component:
deployment_toolkit
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
8
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
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)

                                    

Comments
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.
                                     
2011-12-08



Hardware and Software, Engineered to Work Together