对游戏来说,我们最终关心的是帧率,游戏到底卡不卡还得看帧率,因此做了一个简单的测试看看auto-batching对帧率的提升效果
测试1:各创建2000个精灵,手机上跑的帧率为12.5左右
for i=1, 2000 do
local a = cc.Sprite:create(“grossini_dance_03.png”)
a:setPosition(math.random(800), math.random(400))
self:addChild(a, 100)
local b = cc.Sprite:create("grossini_dance_04.png")
b:setPosition(math.random(800), math.random(400))
self:addChild(b, 100)
end
测试2:各创建2000个精灵,手机上跑的帧率为17左右
for i=1, 2000 do
local a = cc.Sprite:create(“grossini_dance_03.png”)
a:setPosition(math.random(800), math.random(400))
self:addChild(a, 100)
end
for i=1, 2000 do
local b = cc.Sprite:create(“grossini_dance_04.png”)
b:setPosition(math.random(800), math.random(400))
self:addChild(b, 100)
end
结果是:auto-batching对帧率的提升效果不怎么样