I made an ArrayList variant that uses internally a many-items pointer, and whose len and capacity are u32 instead of usize, so that the total size is 16 bytes where the normal ArrayList would be 24. Not sure if it’s a good idea/useful (I was planning to use it actually), but anyway.
This is the unmanaged ArrayList (from 0.15.2 std) for comparison. I removed unmanaged version (and relative tests) to make comparison easier and diff minimal between the two:
This is the 16-bytes version is here:
I called it ArrayList16, but probably it’s badly named because it will be smaller on 16 bit systems. I didn’t change documentation from the original (it still mostly applies).
I left some FIXME comments for stuff I should fix/work out better, but tests are passing.
I’d be grateful for opinions. The most problematic function seems print() because I’m using the deprecated writer() function.
About AI: I asked initial refactor, but scrapped entirely, only kept some helper functions, refactor is manual, function per function. I later used AI again to check errors/bound checks/assertions but that was it. Well the current print() function was suggested by AI.