D - Another idea for the array resizing problem.
- anderson (17/17) Sep 06 2002 The array resizing problem I'm referring to is the use of ~= being slow ...
The array resizing problem I'm referring to is the use of ~= being slow in loops like. for (...) { X ~= Z; ... } My idea is to maintain a small list (4 or 5) of items that have been recently been re-placed due to not being able to fit in the present memory area. When a dynamic array is created, a few of the following elements are mark as reserved (in the list), and can only be used by the array which was created there. It's kind like placing two arrays down. When some lifetime runs out, or a new dynamic array is created, then the protected items are removed from the list. Of course there are still problems with this approach, but perhaps it could be optimised more then the others. I think there is possibly for hardcoding at least some of this algorithm at complier time.
Sep 06 2002