main-- / rust-factorio-ic

name wip
1 stars 1 forks source link

Use GenerationalArena instead of Vec Pcb impls #15

Open oberien opened 4 years ago

oberien commented 4 years ago

https://docs.rs/generational-arena/

main-- commented 4 years ago

Performance impact unclear. We very rarely delete (which is the main benefit of switching to generational arena) and it substantially increases our memory footprint:

Today an Entity is sitting at 40 bytes. Together with the 8 byte index, that's 48 bytes for a single-tile entity (belt, inserter) or 40+9*8 = 112 bytes for 9-tile entities (assembler, furnace).

Generational arena has a 64 bits generation tag, adding 8 bytes to each entity and every index. This gives us 64 bytes for belts and 192 bytes for an assembler.

(Maybe fork the crate and switch to 32-bit index and generation for zero overhead?)