# Efficient object properties

**URL:** <https://discourse.libsdl.org/t/efficient-object-properties/68886>\
**Category:** Game Development\
**Created:** [July 20, 2026, 11:52pm UTC](https://discourse.libsdl.org/t/efficient-object-properties/68886 "2026-07-20T23:52:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krapp](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/krapp/32/4747_2.png) [@krapp](https://discourse.libsdl.org/u/krapp)\
**Post date:** [July 20, 2026, 11:52pm UTC](https://discourse.libsdl.org/t/efficient-object-properties/68886/1 "2026-07-20T23:52:15Z")

</div>

I have an implementation of a tileset using SDL3 and the Tiled API. I’m using the properties API to implement properties. The tileset and individual tiles (and objects and lots of other things) can have their own properties.

The two options I can see are to create a separate property table for each object (which may be empty) or a single table for everything, but adding information in the key (eg “tileset.2.tile.14.property.name”.) Which would be preferable, performance-wise, or does it matter either way? Is there any downside (other than having more allocations) to having a lot of small property tables?

---

<div class="post-metadata">

**Author:** ![Sward](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sward/32/5719_2.png) [@Sward](https://discourse.libsdl.org/u/Sward)\
**Post date:** [July 22, 2026, 5:43am UTC](https://discourse.libsdl.org/t/efficient-object-properties/68886/2 "2026-07-22T05:43:36Z")

</div>

Wait, we don’t even know what programming language you are using. From your description alone I can’t tell whether you are comfortable using pointers, or if they are even supported by your chosen language. It helps to show example code of how you think it should work and we can tell you if we know a better way or not. It will fill in so many of the blanks and open up doors for how we can help.  
Please don’t make us guess so much.

If you are able to implement asset sharing then you can avoid a massive amount of reallocation for similar objects (see [Nystrum’s flyweight chapter](https://gameprogrammingpatterns.com/flyweight.html)).

---

<div class="post-metadata">

**Author:** ![krapp](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/krapp/32/4747_2.png) [@krapp](https://discourse.libsdl.org/u/krapp)\
**Post date:** [July 22, 2026, 10:36pm UTC](https://discourse.libsdl.org/t/efficient-object-properties/68886/3 "2026-07-22T22:36:27Z")

</div>

Sorry. I’m using Lua/LuaJIT. I didn’t mention that because my question was specifically about SDL’s property API. My options are to use a single large shared property id for objects and sub-objects (example - a tileset and tiles) or to create a new property table for each object. I would prefer to use multiple tables but that might result in hundreds of tables.

---

<div class="post-metadata">

**Author:** ![sjr](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sjr/32/5749_2.png) [@sjr](https://discourse.libsdl.org/u/sjr)\
**Post date:** [July 24, 2026, 2:51am UTC](https://discourse.libsdl.org/t/efficient-object-properties/68886/4 "2026-07-24T02:51:35Z")

</div>

Seems like using an entity component system would be more efficient.
