The first phase of dynamic arrays refactoring mentioned previously  is now complete, with dedicated implementations in place for all the base types. A single interface (IScriptDynArray) is now the only common ground.
- Memory usage is reduced to 1/3 on average, performance is improved up to 2x (without JIT)
- Array indexes have thus been bumped from Integer to NativeInt, as arrays of more than 2 billions elements have become more practical
The current state has been frozen in Release snapshot DWScript v21.3.11  on the GitHub mirror.
While the dedicated implementations are mostly similar right now, generics were not used:
- First because the goal was to decouple, and a generic would have introduced coupling again.
- Second because implementations are expected to wildly diverge.
The implementation divergence is most visible right now for the “array of boolean” type: it is implemented though TBits, with a memory usage of 1 bit per element. This means “array of boolean” will now use 192 times less memory !
TBits will eventually be replaced by a more direct implementation, with bit shifting support (for inserts/deletes). Eventually whole-array Boolean operations will be introduced.
Arrays of String & Interface (which also means arrays of script objects or script dynamic arrays) will probably stay as Delphi-dynamic arrays for the medium term.
Virtual Memory for large arrays
Arrays of Integer and Floats will likely diverge from the Delphi-dynamic-array implementation to a lower level one, which would be able to leverage highly-aligned virtual memory.
This would facilitate AVX use, as AVX instructions work on high-ly aligned memory.
But in 64bits, this would allow a leveraging the huge virtual address space, by pre-reserving virtual memory, so that an array can be grown/reallocated without needing to be copied.
The 64bit JIT has partial support for the new dynamic arrays, but this is quite limited at the moment.
The 32bit JIT does not support them yet, so array operations will be interpreted.