[interfacekit] Re: BHandler::fToken

Before I begin!

PEOPLE! We need to make a decision! There are many alternatives, but we need
one!

> There is still the alternative to use a hash map on client side to map
> server tokens (or reuse the handler tokens and use the already existing
> BTokenSpace) to BViews.

No, no, most of the messages came from app_server, so on the client side
is more efficient to cast pointers!

> > > A hash table uses a bit more memory then the data it contains.
> >
> > A little bit...
>
> That depends on the initial capacity of the hash table. If you start with
> 100 and only have 10 views, then you have a usage of 10%. If you have a
> whole bunch of those windows, the overall usage is 10%. In case of a
> global hash table for tokens, the usage will quite likely between
> treshold/2 and threshold.

We will take smaller values! We will make some ( I don't how to say...
statistical tests? )

> > You must be kidding. It's complexity is O(n).
>
> If you have a very bad hash function, i.e. one that maps all elements to
> the same hash value, then you're right. Otherwise -- and when using
> consecutive numbers as tokens this is hard to avoid :-) -- you have O(1)
> complexity.

I think I'm confusing them with hash maps!

> > > If you have a hash table for each window I think the hash
> > > table is more of an overhead than a speed-up.
> >
> > Excuse me??? where is the extra overhead???
>
> When using small hash tables, it is more likely that you'll need to
> rehash, which costs time. In fact a global hash table needs to be rehashed
> sometimes too, and that may actually be quite an effort, but on the other
> hand this could also be done asynchronously. :-P
>
> BTW, as a compromise one could use a hash table per application. Then the
> object pointer is still a unique key and can also be used as hash value
> directly. This does, of course, only work, if the tokens doesn't need to
> be unique in the whole server.

Yes, but only for BViews (not BWindows) and perhaps BBitmaps!

And Ingo! Are you sure that hash tables are better than linked lists?? What
I mean, is, there aren't so many views in a window! A linked list would
handle them just fine! We're talking about 1K of additional memory if we
have 256 views in a window, and that's a lot of views...



Other related posts: