cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCHES RFC 2/2] Optional hash table improvements

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 2 May 2007 19:23:41 +0200 (CEST)

On Wed, 2 May 2007, Robert Iakobashvili wrote:

>> hash_fd() is added as a library-wide symbol. If it should remain so, it
>> should be Curl_ prefixed, but it seems to only be used from within multi.c
>> so I suggested it is moved there and made static. What do you say?
>> fd_key_compare seems to be in the same position.
>
> I am used to keeping hash functions in some visible place, so that other
> modules could use it when necessary, but no problems with keeping them
> static.

Well, if they would be used by other files then I too would like them there,
but until then I rather see them static. I'm not a believer in creating things
for a possible future use now, I rather write good code now and move it to the
generic case later on if we find the need to.

>> Is this complication really necessary? I mean, why not just do it:
>> return fd % (int)slots_num;
> No problems with both impementations

Well, my shorter one is simpler to read but slightly slower to execute for the
fd > slots_num case. But quite possibly the difference is too small to
actually get noticed.

> When it is an ifndef-ed define, one may overwrite it.

Yes, sure, but only if you rebuild the lib and the vast majority of all
libcurl users use a pre-built or at least an already-built binary. Besides,
even if you do a custom build, you may want a library that adapts fine for
both the little use as well as the execessive amount of connections case.

>> I mean, if someone goes mad and tries 100,000 connections they probably
>> will see that upping this size even more will be very beneficial to them...
>
> Actually, we were really planning doing that in a couple of months... and
> our madness is limited only by some more urgent features/issues and absence
> of appropriate HW.

What's the largest number of connections you've "done" so far?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-05-02