[Mono-list] List.FindAll method implementation

Juan C. Olivares juancri at gmail.com
Mon Mar 19 02:51:26 EDT 2007


I followed some instructions from Miguel and here we have this brand new
patch.

It uses the new algorithm bits-on-stack for
System.Collections.Generic.List<T>::FindAll
(Predicate). This algorithm stores a group of uint's in the stack and uses
their bits as flags.

Because there's no way to know the size of the stack in any moment in time,
Miguel suggested me to limit this new method to use only 8KB of the stack...
so it will be useful for list with 8 * 1024 * 8 elements or less. Bigger
lists will use the old algorithm.

It also includes few testcases.

Juan C. Olivares
www.juancri.com

On 3/18/07, Juan C. Olivares <juancri at gmail.com> wrote:
>
> I'll check...
>
> Juan Cristóbal Olivares
> www.juancri.com
>
> On 3/18/07, Miguel de Icaza < miguel at novell.com> wrote:
> >
> > Hello,
> >
> >     I feel a bit strange that the bools are allocated using
> > numbers.Count but the loop uses this._items.   I rather keep them in
> > parallel.
> >
> >     Also, another idea might be to use three code paths depending on the
> > number of items:
> >
> >         * [0,N] use bools.
> >         * [N,M] use bitbools.
> >         * [M,infinity] use the old method.
> >
> >     Thread stacks could not be very large, and you would like to avoid a
> > crash in that condition.   Actually, I wonder if stackalloc returns a
> > null if the requested size is larger than the available stack.
> >
> > Miguel.
> >
> > > Attached.
> > >
> > > Juan C. Olivares
> > > www.juancri.com
> > >
> > > On 3/18/07, Miguel de Icaza < miguel at novell.com> wrote:
> > >         Hello,
> > >
> > >         >
> > >         > Do you have any comment?. I could send a patch...
> > >
> > >         These numbers look fantastic.   We would love to see a patch.
> > >
> > >         > best regards
> > >         >
> > >         > Juan C. Olivares
> > >         > www.juancri.com
> > >         >
> > >         >
> > >         >
> > >         > _______________________________________________
> > >         > Mono-list maillist  -  Mono-list at lists.ximian.com
> > >         > http://lists.ximian.com/mailman/listinfo/mono-list
> > >
> > >
> > > _______________________________________________
> > > Mono-list maillist  -   Mono-list at lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-list
> >
> >
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070319/024d0caf/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: list.patch
Type: text/x-patch
Size: 4113 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20070319/024d0caf/attachment.bin 


More information about the Mono-list mailing list