As it stands, big grids with sparsely placed items will use a lot more memory than they should, as the placement grid is represented as a 2D array, one element per cell, whether or not that cell is filled.
Chrome's implementation uses a LinkedList, and skips past empty regions. It could be used as a model for how ours should work.
An easier way to reduce memory usage might be to use a Uint8List to represent the placement grid. That way you'll still have an element for every cell, but each element will only be 1 byte each.
As it stands, big grids with sparsely placed items will use a lot more memory than they should, as the placement grid is represented as a 2D array, one element per cell, whether or not that cell is filled.
Chrome's implementation uses a LinkedList, and skips past empty regions. It could be used as a model for how ours should work.