[interfacekit] Re: BHandler::fToken

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: interfacekit@xxxxxxxxxxxxx
  • Date: Tue, 11 Mar 2003 20:41:41 +0100 (MET)

On Tue, 11 Mar 2003, Axel =?iso-8859-1?q?D=F6rfler ?= wrote:

> Erik Jaesler <erik@xxxxxxxxxxxxxx> wrote:
> > Just a thought; feel free to rip it to shreds. ;)  The reason I
> > included
> > a re-use stack was to avoid the performance hit of having to search
> > the
> > map for an unused token.  How about this compromise solution:
> > continue
> > to place "returned" tokens on the stack, but don't use them until the
> > token counter maxes out.  Also, use a queue instead of a stack to add
> > a
> > bit more separation between the return and re-issue of a given token.
> > I
> > will look at using a hash map instead of a regular map.
>
> There is just one little problem with that method (depends on the
> implementation, though :-)): when the token counter overflows, there
> are about 4 billion entries on the stack... hm... that doesn't sound
> very nice, does it=3F :-)

Exactly. :-)

BTW, the `searching' for unused tokens shouldn't be that expensive anyway.
Till the overflow (which is extremely unlikely anyway) it's at zero costs
and thereafter you will ususally don't do more than one lookup. Unless, of
course, you are indeed using the most part of the available token space.
But then you have greater problems, anyway. ;-)

CU, Ingo

Other related posts: