pytmx icon indicating copy to clipboard operation
pytmx copied to clipboard

gid and tests

Open JaskRendix opened this issue 1 year ago • 2 comments

So, I wanted to walk you through some improvements I made to the decode_gid function. One of the main things I did was implement a global cache. Essentially, a dictionary called flag_cache that stores the mapping between raw GIDs and their corresponding TileFlags objects.

This way, if we encounter the same GID again, we can just grab the cached result instead of recalculating it.

Everything else are additional tests.

Do we need to implement a ValueError if raw_gid < 0?

JaskRendix avatar Aug 26 '24 09:08 JaskRendix

Out of curiosity did you profile/time this at any point? Curious how big of an affect this has on loading a map

joereynolds avatar Sep 05 '24 13:09 joereynolds