开发者

ActionScript 3 Optimization - improving performance with large #'s of objects

开发者 https://www.devze.com 2023-02-04 17:05 出处:网络
I\'m devloping some library classes for flocking/steering behaviours on large numbers of objects (2000+). I\'m finding that at < 500 instances, performance is reasonable. As the numbers increase, f

I'm devloping some library classes for flocking/steering behaviours on large numbers of objects (2000+). I'm finding that at < 500 instances, performance is reasonable. As the numbers increase, framerate bogs down开发者_JAVA技巧.

I've seen remarkable performance with libraries such as Flint or Box2D with ridiculous #'s of particles / objects, so it should be possible to optimize / refactor my code to be a bit better.

I'm aware of the basic optimizations, such as bitwise operations and optimized for loops. Are there any more fundamental approaches I should be considering? For example, currently each instance is a vector-based MovieClip. Would working with BitmapData be more efficient?


forget about vectors.

cache them as bitmapdata and draw to a bitmap, or draw a bitmapfilled rect to graphics.

dont use vectors. find a way around it. be clever. bitmap lookup tables, caching, more lookup tables. spend RAM on caching things for different orientations, views, frames, etc, rather than spending PROCESSOR on wasteful cpu cycles.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号