This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: java.net: Classpath vs. libgcj Comparison
"Aaron M. Renn" wrote:
> I personally think that caching is a potentially useful operation.
> For example, if a web page is loading many images off of the same
> server, it would be nice to not have to perform DNS lookups for every
> image loaded. The browser app could cache these, I suppose, but why
> should it have to? Perhaps there's something to be said for disabling
> caching by default though, which is easy to do.
You shouldn't be doing a DNS lookup every time! You should call getByName()
once, and pass the returned INetAddress object each time you make a
connection.
> One reason not to rely on OS or native library level caching is that
> this necessitates a round trip into native code, which can be very
> expensive in JNI. In the compiled libgcj environment using CNI, this
> might be less of a concern.
This is the only advantage I can see to caching, but, again, in a well
written program, getByName() should be called fairly infrequently.
regards
[ bryce ]