[interfacekit] Re: Portlink implementation

On Tue, 22 Oct 2002 01:26:39 +0300 "Adi Oanca" <e2joseph@xxxxxxxxxx> 
wrote:
> 
> > While that sounds OK, I would still vote for using BMallocIO. It 
> > would
> > require less coding and I don't see significant drawbacks in
> > comparisson with your idea.
> 
>     OK, To be honest, I still don't know what a bunch of Be API 
> classes do.
> BMallocIO is GREAT for my purpose.
>     I too would use it, but I still have ask you something.
>     It seems that the only way a BMallocIO object can be 
> consistent(it's
> buffer = contiguous) at resizing, an allocation + copying + 
> deallocation is
> necessary! Am I wrong, but isn't this almost the same as the original
> method?

It uses realloc() internally. So, if the allocation can be resized in 
place, no copying is necessary, otherwise it needs to be relocated. 
Hence, for data fitting into a `1 * chunk size' sized buffer, it 
performs exactly like your proposal. For `2 * chunk size' it performs 
at least as good as your strategy, sometimes better. In general the 
realloc() strategy is O(n^2), but in best case twice as fast as yours. 
Unless it is to be expected, that the size of the data will exceed like 
`20 * chunk size' I wouldn't really give it much thought (or rather 
increase the chunk size :-).

> > > BTW: Ingo! You said you'll supply us with a small library for 
> > > using
> > > simple/double liked lists, hash tables,... whre is it? :)
> >
> > More correctly Tyler and I wanted to implement such a library. :-)
> > It's beginnings are in `headers/private/kernel/util'. I only now 
> > and
> > then added bits I needed and Tyler currently doesn't have time for 
> > it,
> > so there are only few classes at this time. Basically only
> > SinglyLinkedList, Vector, and Vector{Set,Map}. For the AVLTreeMap I
> > currently see no chance to get it past our buggy compiler. Also the
> > interfaces are not completely stable, so if you want to use any of 
> > the
> > classes, keep that in mind.
> 
>     I'm a little sorry to say this, but, such classes should've been 
> ready
> from long time ago!

Till now, noone has complained. And actually for userland there is a 
very complete library -- the STL.

CU, Ingo


Other related posts: