Follow up to my announce + some additional notes.

list.c checked in + intlist fix + 3 more tests.

Leopold Toetsch wrote:

> 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


- list_delete(..., idx, n_items)
- list_insert(..., idx, n_items) ... make room for n_items at idx

These should it make fairly simple to implement splice().


As mentioned in the file, list.c can emulate intlist.c, so intlist.c 
users - please - give it a try: just compile/link list instead of intlist.

Status:
- Runs all intlist tests
- insert/delete is only barely tested, this needs definitely more, 
especially combined and mixed with other operations.

If people agree, we could start to base other array classes on list.c, 
though I'd rather do classes cleanup and keyed access first.


Comments welcome,
leo


Reply via email to