----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 06, 2004 12:05 AM
Subject: cvs commit: 
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/parser HTMLParser.java


> jsalvata    2004/02/05 16:05:54
>
>   Modified:    bin/testfiles HTMLParserTestCase.all HTMLParserTestCase.set
>                src/protocol/http/org/apache/jmeter/protocol/http/parser
>                         HTMLParser.java
>   Log:
>   Added a comment on a potential performance problem...
>   ... and trimmed 10 seconds off test execution time.

Excellent!

>   +            // An additional note on using HashSets to store URLs: I just
>   +            // discovered that obtaining the hashCode of a java.net.URL implies
>   +            // a domain-name resolution process. This means significant delays
>   +            // can occur, even more so if the domain name is not resolvable.
>   +            // Whether this can be a problem in practical situations I can't 
> tell, but
>   +            // thought I'd keep a note just in case...


Hopefully the host-names would already be cached, so that resolving the name would not 
take long - and if not cached, hashing the
URL should cache the host name ready for HTTPSampler. Not sure if non-existent host 
names are cached; if not, then they would incur
a double penalty.

>   +            // BTW, note that using a Vector and removing duplicates via scan
>   +            // would not help, since URL.equals requires name resolution too.

[It looks like Mr Gosling was responsible for the decision to compare hosts using 
their IP addresses!]

Equal objects must have equal hashcodes, so if one uses the IP address, the other must 
as well.

>   +            // TODO: maybe change the API to return URL Strings instead of 
> java.net.URLs?

Since the HTTPSampler would need to re-create the URLs in order to use them, perhaps 
we could use URL.toString() as the hash key,
and store the URL as the value? Would require more storage, but no need to recreate 
the URLs.

Might be fun to create a Collection to handle this automatically - or there may 
already be something suitable in Commons-Collections
(which JMeter already uses - albeit by ListenerNotifier only!).

S.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to