通过简单的Canvas2D游戏,Chrome Android上的FPS速率低

发布于 2025-01-30 09:19:25 字数 608 浏览 1 评论 0原文

我目前正在开发一个简单的2D帆布视频游戏,在测试性能时,我注意到AndroïdChrome(约45fps)的帧速率非常令人失望。

大约有两个帧中断。而且我看不到我的呼叫堆栈中正在创建性能问题。正如您在性能捕获中看到的那样,任务持续少于4ms(在16ms的刷新下)

“

Zoomed:

​游戏循环...几乎没有任何东西(我删除了所有游戏内容):

Game.loop = function(){ 
    ctx.setTransform(1,0,0,1,0,0);
    
    ctx.clearRect(0, 0, canvas.width, canvas.height);

        
    requestAnimationFrame(Game.loop);
}

I'm currently developping a simple 2D canvas video game and while I was testing performance, I noticed that there is a very disappointing frame rate on Androïd Chrome (about 45fps).

About one out of two frame breaks. And I cannot see what in my call stack is creating the performance issue. As you can see on the performance capture, the task lasts less than 4ms (which is under the 16ms of refreshing)

Screenshot of performance viewer

Zoomed :

enter image description here

And here is the sample code of the game loop... with almost nothing in it (I removed all the game stuff) :

Game.loop = function(){ 
    ctx.setTransform(1,0,0,1,0,0);
    
    ctx.clearRect(0, 0, canvas.width, canvas.height);

        
    requestAnimationFrame(Game.loop);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文