Closed scriptorum closed 9 years ago
Thanks. I still think we could get move that Type.getClassName to compile-time, but I probably won't have time to work on it, so I'll just merge this.
Heh, I understand. I'd love to know how one can determine Type.getClassName()
at compile-time. Macro, I suppose.
@scriptorum can you make a quick test on other targets if there is also a benefit? Thanks.
@loudoweb No problem. So the answer is yes, there was a speed improvement for each platform I tested. I repeatedly executing a loop resulting in at least 1500 entity adds with 10 components added to each, and timed the loop duration in seconds.
Platform | Before | After |
---|---|---|
Mac | 1.8 | 1.1 |
Flash | 5.3 | 2.5 |
Neko | 11.5 | 5.9 |
Awesome. Thank you!
My application uses Flaxen which can have a significant number of components per entity. This incurs a large number of calls to
ComponentMatchingFamily.addIfMatch
, especially when creating a bunch of entities at the same time. This profiles poorly mainly due to the customClassMap.keys
implementation.I've reworked that class to use a separate
StringMap
of class names to classes, which lets me replace theClassMap.keys
iterator with a simple call to keyMap.iterator. This runs much faster, at least on Flash. I have not tested this on other targets.