Chrome中的FPS上限为60fps(FPS in Chrome capped at 60fps)

编程入门 行业动态 更新时间:2024-10-19 09:38:24
Chrome中的FPS上限为60fps(FPS in Chrome capped at 60fps)

我一直在使用JavaScript进行画布工作,我注意到Chrome中的FPS似乎达到60fps,直到打开检查器(右键单击并点击“Inspect Element”访问开发工具)。

如果我在其他浏览器中运行我自己的代码,则没有FPS问题,同样如果我在检查器工具打开时在Chrome中运行没有问题,它会立即以每秒120帧的速度拍摄。

作为展示实际示例的一种方式,请查看此页面: http : //mbostock.github.io/d3/talk/20111018/collision.html

如果我在没有打开检查器工具的情况下查看此页面,则FPS图表显示每秒40到60帧。 但是,一旦检查员打开,FPS会立即再次跳到120 FPS,并且在视觉上和身体上都更具响应性。

我真的很难理解为什么会这样,并且理想情况下我希望我的代码运行就像检查器窗口打开一样。 基本上,处理的时间量似乎正在大幅下降。

这是在非调试环境中执行的已知代码限制吗?

任何见解将不胜感激,谢谢:)

I have been doing some work with the canvas using JavaScript and I have noticed the FPS in Chrome seems to cap out at 60fps until such point as opening the inspector up (the dev tools accessed from right clicking and clicking "Inspect Element").

If I run my own code in other browsers there is no FPS issues, likewise if I run in Chrome when the inspector tools are open there is no issue, it instantly shoots up to 120 frames per second.

As a means of showing a practical example, take a look at this page: http://mbostock.github.io/d3/talk/20111018/collision.html

If I view this page without my inspector tools open, the FPS graph shows between 40 and 60 frames per second. However, as soon as the inspector is open, the FPS instantly jumps to 120 FPS again and is visually and physically more responsive.

I'm really struggling to understand why this is and ideally would like to have my code running as if the inspector window was open. As essentially the amount of time being given for processing seems to be dropping by a substantial amount.

Is this a known limit of code being executed in a non-debugging environment?

Any insight would be much appreciated, thank you :)

最满意答案

在阅读了Cuberto的调查结果后进行了一些实验后,似乎这可能是Chrome和双显示器设置的错误。

正如Cuberto建议的那样,我尝试将窗口调整得更小一些,这使得FPS的拍摄重新开始。 即使没有屏幕最大化,但仍然跨越大部分屏幕它将是最大FPS。

奇怪的是,我禁用了我的第二台显示器,然后将Chrome重新置于最大化状态,这很好。

一旦我重新启用第二台显示器,FPS再次击落,所以看起来这就是问题所在。

更新:似乎其他人在双显示器上遇到了同样的问题(请参阅评论): 为什么Chrome会将帧速率限制为30fps?

After experimenting a bit further after reading Cuberto's findings, it seems that this may be a bug with Chrome and dual monitor setups.

As Cuberto suggested, I tried resizing my window a bit smaller, and this made the FPS shoot back up. Even if didn't have the screen maximised, but still had it spanning most of the screen it would be at max FPS.

Curiously, I disabled my second monitor and then put Chrome back into the maximised state, and it was fine.

As soon as I re-enabled my second monitor the FPS shot down again, so it would appear this is the problem.

Upd: it seems someone else has had this same problem with dual monitors (see comments): Why would Chrome cap frame rate at 30fps?

更多推荐

本文发布于:2023-07-18 04:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1154868.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上限   FPS   Chrome   capped   fps

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!