The current implementation of array.pmc is rather inefficient and 
limited - and really slow.

So I rewrote the base routines almost from scratch and have currently a 
file named list.c, which I will commit (yep cvs ci, thanks to Dan, Steve 
and others, who made this possible) in the next future - if people agree.

Some features:

- list.c is based roughly on principles of intlist.c
   (chunk based, fast index set/get, push/pop/shift/unshift)
- can handle <null> arrays, no chunk allocation first
- can store packed char, short, int, num, PMC* (void*), ...
- different growing policies:
- growing (min alloc 4 items/chunk -> max 1024 items/chunk
   (both are defines but above are good limits in tests)
- or fixed 1024 items/chunk for arrays first accessed
   like "set P0[500], I0"
- same speed as intlist, ~double speed for big # (10^6) items
- can handle sparse arrays, saving many MBs for very sparse arrays

Currently I'm testing it as an intlist substitute (via wrapper functions 
built in), it runs all intlist tests + 2 more WRT sparse access.

So, if people are ok with this, i'll commit it as list.c in parrot's 
root (+ some more t/pmc/intlist.t). Transition of array.pmc may then 
follow later.

It's currently not intended to replace intlist.c, I don't know the 
planned usage patterns for intlist (rx stack?). Some optimizations in 
list.c might also improve intlist.c so that this would be a special and 
therefore faster array with limited capability.
If conserving memory is an issue, list.c is much more efficient for very 
small and very big arrays. We will see.

I know, that Peter is working on a similar array substitute, so I 
announce the status of my list.c - and when he has a better array, we 
can always change to it. Or we take the best things out of the two and 
improve it even more.

Comments welcome,
leo

Reply via email to