分析 ASP.NET
我想分析 ASP.NET 代码的各个部分,以便能够根据一些实数客观地比较替代方法。
一个很好的例子是:我希望看到一条指令跟踪,了解渲染转发器时发生的情况与(blech - 以下不是我的想法)在连接的字符串或字符串构建器中构建标记并发送到浏览器时发生的情况。我还希望能够演示如何有效地连接增长到 100kB+ 的字符串,每次在末尾添加字符或字符串时都需要两倍于字符串长度的内存。
有这样的工具可用吗?
更新
这里有一些很好的回复,但没有任何内容可以回答如何获取指令跟踪的问题。
I'd like to profile sections of asp.net code to be able to objectively compare alternate approaches based on some real numbers.
A good example is: I'd like to see an instruction trace for for what happens when a repeater is rendered vs (blech - the following is NOT my idea) building markup in a concatenated string or stringbuilder and emitting to the browser. I'd also like to be able to demonstrate how concatenating strings that grow to 100kB+ effectively requires memory in the amount of double the string length every time you add a character or string to the end.
Are there any such tools available?
Update
There are a couple of good replies here, but nothing that answers the question if how to get an instruction trace.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
red-gate 具有适用于 .NET 的配置文件和内存分析器。我只是尝试过它们,但它们看起来非常好,可能会给你你想要的东西。
red-gate has a profile and memory profiler for .NET. I've only trialled them, but they seemed very good and may give you what you want.
Microsoft 有一个内存分析器(下载:http://www.microsoft.com/downloads/details.aspx?familyid=86ce6052-d7f4-4aeb-9b7a-94635beebdda&displaylang=en)。
以下是有关如何使用它的一些说明:http://msdn.microsoft。 com/en-us/library/ms979205.aspx
您会注意到说明中的屏幕截图很好地提供了有关您试图得出结论的特定问题(字符串连接与字符串生成器)的详细信息在。
Microsoft has a memory profiler (download: http://www.microsoft.com/downloads/details.aspx?familyid=86ce6052-d7f4-4aeb-9b7a-94635beebdda&displaylang=en).
Here are some instructions on how to use it: http://msdn.microsoft.com/en-us/library/ms979205.aspx
You'll notice the screenshots in the instructions do a good job at providing detail regarding the specific question (string concatenation vs. string builder) you were trying to draw a conclusion on.
如果现有的分析器不能满足您的要求,您始终可以使用 Stopwatch 类,它可以在大多数系统上提供亚毫秒级的精度。
If existing profilers don't do what you're looking for, you could always use the
Stopwatch
class, which can provide sub-millisecond accuracy on most systems.我从来没有听说过任何东西可以给你一个指令跟踪,本身。探查器所做的就是告诉您哪些代码执行时间最长。
I've never heard of anything that's going to give you an instruction trace, per se. All a profiler does is tell you which code takes longest to execute.