URL often are used as keys for hashtables. E.g. see 6754990.
Same is applicable to deployment cache, etc.
If nothing is really download from the network then DNS lookups are one of most expensive operations that may happen. Especially if DNS access is slow.
Proposed solution is:
1) for hashcode() use only file/protocol/port unless file portion is really short
In later case use host inet address too
2) for hostEquals() - first check string representations and if they match then do not perform DNS lookup
This version of hashcode() will still obey hashcode()/equals() contract. It will increase hashcode coincidence in some cases (if file paths are the same). But there are only few patterns when this may happen
(e.g. root page of the site) and we can workaround some of them using minimal requirement on length of file portion.
See suggested fix for details.
Same is applicable to deployment cache, etc.
If nothing is really download from the network then DNS lookups are one of most expensive operations that may happen. Especially if DNS access is slow.
Proposed solution is:
1) for hashcode() use only file/protocol/port unless file portion is really short
In later case use host inet address too
2) for hostEquals() - first check string representations and if they match then do not perform DNS lookup
This version of hashcode() will still obey hashcode()/equals() contract. It will increase hashcode coincidence in some cases (if file paths are the same). But there are only few patterns when this may happen
(e.g. root page of the site) and we can workaround some of them using minimal requirement on length of file portion.
See suggested fix for details.
- relates to
-
JDK-6826780 URLClassPath should use HashMap<String, XXX> instead of HashMap<URL, XXX>
-
- Resolved
-
-
JDK-6826801 JarFileFactory should not use HashMap<URL>
-
- Resolved
-
-
JDK-6797730 Umbrella: Applet startup performance improvements
-
- Closed
-
-
JDK-6826789 SecureClassLoader should not use CodeSource URLs as HashMap keys
-
- Closed
-
-
JDK-6754990 Applet.getImage is slow
-
- Closed
-