gpt4 book ai didi

c# - 如何证明某个版本的程序内存效率更高?

转载 作者:行者123 更新时间:2023-11-30 20:05:26 24 4
gpt4 key购买 nike

我有一个必须处理数十万条记录的应用程序。现在,我一次只能处理其中的 500 个。每批处理/分析最多可能需要 5 分钟(总共约 10 小时的处理时间)。限制 500 条记录的原因是内存消耗。我认为我们的程序占用这么多内存的主要原因之一是我们没有设置列表或字典的大小(例如,new List() 而不是 new List(100000))。我进行了更改以设置集合的大小,以便 .NET 停止创建和复制具有额外容量的新列表。

这是我的问题:如何证明一个程序版本的内存效率更高?我应该查看性能计数器吗?工具?监控?

最佳答案

有类似 .net memory profiler 的工具您可以从中深入分析 .net 应用程序的内存管理和内存泄漏。

.NET Memory Profiler is a powerful tool for finding memory leaks and optimizing the memory usage in programs written in C#, VB.NET or any other .NET Language. With the help of the profiling guides, the automatic memory analyzer, and specialized trackers, you can make sure that your program has no memory or resource leaks, and that the memory usage is as optimal as possible.

关于c# - 如何证明某个版本的程序内存效率更高?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11372153/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com