Skip to content

[Feature request] Rectangular packing for structs of arrays (SoA) #1667

@Rangi42

Description

@Rangi42

This idea has come up many times before:

  • @pinobatch implemented rectallocate.py to allocate arrays into a "shelf", and has previously cited "Efficient Algorithms for 2-D Rectangle packing" (Discord).
  • @evie-calico was looking for help with a "page-based array of structs" (Discord), which ISSOtm clarified can't yet be automatically done.
  • Sono requested "sections with holes" to implement "structs in memory, but scattered" (Discord), which ISSOtm clarified as "2D packing".
  • JoaoBapt requested "sparse sections" (Discord), which ax6 rephrased as "2D memory packing", prompting this issue to be created.

I'm citing those previous Discord chats because they discuss some of the possibilities for how such a thing could work, and highlight the pitfalls of doing so ("the two alternatives are a bodge or an over-complicated and over-specialized "correct" solution").

It's possible that RGBDS may never get a built-in solution to this problem: I too would like to avoid over-complicated and over-specialized solutions. And maybe there isn't one; "structures of arrays" / "parallel arrays" rarely have built-in support even in high-level programming languages (with Zig being one example that does). This issue exists to iron out a sufficiently-general solution if possible (and just to record/remember that the user demand exists.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementTypically new features; lesser priority than bugsrgbasmThis affects RGBASMrgblinkThis affects RGBLINK

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions