Closed floybix closed 9 years ago
Thanks! I don't think we can assume that tiled-map-layer
accepts a string, because people may be passing an index to it. Other than that it looks great.
That reflection on .get
is a major hit to performance because it is called so often - on every render cycle many times to check valid movement of entities.
The following could avoid the reflection:
(let [layers (-> ^BatchTiledMapRenderer (u/get-obj screen :renderer)
.getMap
.getLayers)]
(if (number? layer)
(.get layers (int layer))
(.get layers (str layer)))))))
OK that sounds good, can you send a PR? On Mar 16, 2015 9:41 AM, "Felix Andrews" notifications@github.com wrote:
That reflection on .get is a major hit to performance because it is called so often - on every render cycle many times to check valid movement of entities.
The following could avoid the reflection:
(let [layers (-> ^BatchTiledMapRenderer (u/get-obj screen :renderer) .getMap .getLayers)] (if (number? layer) (.get layers (int layer)) (.get layers (str layer)))))))
Reply to this email directly or view it on GitHub https://github.com/oakes/play-clj/pull/77#issuecomment-81669388.
Hi, these showed up in some profiling i did:
isa?
(and its underlyingClass.getInterfaces
) and reflection on.get
intiled-map-renderer*
.