DragonBones / DragonBonesAS

DragonBones ActionScript Runtime
MIT License
250 stars 117 forks source link

Little fixing TransformUtil::matrixToTransform boosted my performance more than 2x times #65

Closed arhcy closed 8 years ago

arhcy commented 8 years ago

Hi, I'm using dragonbones 4.1 for my Starling based project. Also has remade it for "fast" armature and animation.

After adding of 25 animated instances there was performance downgrade on old Android devices. Scout researching showed that main bottleneck of performance is TransformUtil::matrixToTransform that using Number::toFixed function. I've removed that and saw big performance boosting. I'm afraid of unexpected behavior in future, but if you can find way to optimize, it should be really cool!

Also instantinating Array variable in this function causes performace downgrade and lot of garbage. Remaking skewXArray and skewYArray to Vector and class field not local variable made dragonbones memory allocations super-minimal :)

This tweaks made my mobile performance from 25 fps to very close 60

freem-trg commented 8 years ago

Hi. I have made some optimizations (including optimization you've write about) here: https://github.com/DragonBones/DragonBonesAS/pull/61 Just try it, and you will have no problems with perfomance ;)

akdcl commented 8 years ago

The bug has been fixed :)