- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
跟进my previous question关于 Profiler 峰值。我刚刚发现,如果我在 Unity3D 中启用 deep profile 选项,我可以看到 ScrollRect.LateUpdate()
下的 GetComponent()
调用占用了高达 2.4 MB 的垃圾内存只有 5 个 Scroll Rect
组件的集合。从下面的快照中可以明显看出,Unity 在 LateUpdate()
方法中调用了 Component.GetComponent()
4046 次,这会导致性能问题。我的应用程序是 UI 密集型的,但是 2.4MB 的 GC 是根本不能接受的。
通常建议不要在任何更新方法中使用GetComponent()
,但Unity 自己的实现打破了惯例。这限制了我在一个场景中可以拥有的 UI 项目的数量以避免性能问题。
请注意,当我激活菜单对象时,此分析数据仅来自框架。
是否有减少/节省 2.4MB 内存的解决方法?
最佳答案
Usually It is recommended not to use GetComponent() in any of update methods but Unity's own implementation is breaking the convention
Unity 的 GetComponent()
在构建应用程序时不分配内存。构建应用程序来验证这一点。它仅在编辑器中分配内存。
Unity 制作了一个 post几年前的事:
We do this in the editor only. This is why when you call GetComponent() to query for a component that doesn’t exist, that you see a C# memory allocation happening, because we are generating this custom warning string inside the newly allocated fake null object. This memory allocation does not happen in built games. This is a very good example why if you are profiling your game, you should always profile the actual standalone player or mobile player, and not profile the editor, since we do a lot of extra security / safety / usage checks in the editor to make your life easier, at the expense of some performance. When profiling for performance and memory allocations, never profile the editor, always profile the built game.
建议分析真实游戏而不是编辑器中的游戏。
关于performance - ScrollRect.LateUpdate() 分析器中分配 GC 高达 2.4MB 的尖峰,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39002361/
我有一个本地存储库,有一个大文件被意外添加到其中。现在,即时通讯几乎落后了100次提交。当我尝试推送到GitHub时,它给了我一个错误。 我需要做任何我需要做的事情,以便能够推送此存储库的其余部分。
我正在尝试分配内存NSImage*originalLocationImage; NSURL *fileURL = [NSURL fileURLWithPath:originalLocation];//
我如何以及在何处可以编辑CDH4.7中的输入拆分大小,默认情况下为64 MB,但我想将其称为1MB,因为我的MR作业运行缓慢并且我想提高MR作业的速度。我想需要编辑cor-site属性IO.file.
我创建了一个 DLL,其中包含一个从 C# 代码调用的 JNI 函数。作为长时间运行的 GUI 应用程序的 C# 应用程序多次调用该函数。 我的 JNI 函数调用 JNI_GetCreatedJava
运行 TestDFSIO 后,我得到了以下指标: 2019-04-30 09:50:35,790 INFO fs.TestDFSIO: Date & time: Tue Apr
我正在测试连接到 Xcode 5.1.1 的运行 iOS 7.1 的 iPhone 4。我不明白为什么当仪器显示我的应用程序仅使用几兆字节并且有大量可用内存时我会收到内存警告甚至崩溃(见附件)。有什么
我有一个假设的值数据库,每个值的大小为 4 个字节(即 4,000,000,000)。所有值都存在于数据库中,因此它以 0 开头,以最大的 4 字节数字结尾。 只有一次,我想通过将 1 到 10000
我有一个字符串元组的 python 列表,格式如下:lst = [('xxx', 'yyy'), ...etc]。该列表包含大约 8154741 个元组。我使用了一个分析器,它说该列表占用大约 500
我需要每秒发送 1,00,000 批记录。我在实验后得到的是 azure event hub 的事件限制为 10,00,000 个字节。我的每条记录有 145 字节,我必须发送的总记录是 1,00,0
HDFS块大小默认为128 MB(来源:https://hadoop.apache.org/docs/r2.9.0/hadoop-project-dist/hadoop-hdfs/hdfs-defau
我需要每秒发送 1,00,000 批记录。我在实验后得到的是 azure event hub 的事件限制为 10,00,000 个字节。我的每条记录有 145 字节,我必须发送的总记录是 1,00,0
我正在 Linux 机器上运行 Jboss EAP 服务器 6.1。分配的堆内存如下。 JAVA_OPTS="-Xms2048m -Xmx2048m -XX:MaxPermSize=256m -Dja
我最近提出并解决了一个关于将大于 2 MB 的 .PDF 文件作为 BLOBS 上传到 MySQL 数据库的问题。我不得不更改我的 php.ini 文件中的一些设置和 MySQL 的最大数据包设置。然
我需要创建一个文本文件(字母数字),其大小(精确或接近)以 MB 为单位等于我输入的数字,例如 1 MB。我试图生成一个字符串,认为一个字符是 16 位或 2 字节,所以:1KB = 1024 字节
我已经阅读了很多有关通过设置 yarn.scheduler.maximum-allocation-mb 来解决此类问题的内容,我已将其设置为 2gb,因为我当前正在运行 select count(*)
这个问题在这里已经有了答案: this exceeds GitHub's file size limit [duplicate] (3 个回答) 1年前关闭。 核心程序崩溃数据。 我不知道核心文件是从
我已经建立了一个 Electron 应用程序,并使用 Electron 打包程序对其进行了打包。我制作了238MB的Windows bundle 包,而Linux版本是450 MB。我将其与也是 El
这个问题在这里已经有了答案: Generate an integer that is not among four billion given ones (38 个答案) 关闭 9 年前。 Give
我的 Meteor 应用程序获取一个 CSV 文件,使用 Baby Parse(Papa Parse for server)对其进行解析,并将数据插入到 MongoDB 集合中。 每个 CSV 行都作
Amazon SES 有 10 MB 的文件限制 我的问题是 有没有其他方法可以发送超过 10 MB 的文件? 最佳答案 这是一个硬限制。 您需要做的是包含您当前包含在电子邮件中的 Assets 的
我是一名优秀的程序员,十分优秀!