bjorn/tiled — pull request #362 by oskarwiksten (2013-02-16 12:25:09+00:00)
Title: libtiled-java: Add support in TMXMapReader for caching and reusing loaded tilesets.

In the game that I develop, we have a lot of TMX files (>300) that all have the same definition of their tilesets, they all use the same tileset images, and all tilesets have the same gids in all TMX files.

When loading all of the TMX files one by one, most of the execution time is spent loading the bitmaps for the maps. In out use-case, since all of the bitmaps are the same, it ought to be possible to reuse the ones that have been loaded for the first few maps.

This patch adds support in TMXMapReader to reuse cached tilesets, that have the same name and gid. This drastically speeds up loading times when parsing several TMX files using the same TMXMapReader object instance.