有许多方法可以杀死代码速度? [英] Many Methods Kill Code Speed?

查看:65
本文介绍了有许多方法可以杀死代码速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建的应用程序的运行速度大大慢于其应有的速度(一个过程需要4秒钟,而只需要0.1秒钟,这至少是我的目标).

I'm building an application that is seriously slower than it should be (a process takes 4 seconds when it should take only .1 seconds, that's my goal at least).

我有一堆将一个数组传递到另一个数组的方法.这使我的代码保持了良好的组织性,但是我担心它会破坏我的代码的效率.

I have a bunch of methods that pass an array from one to the other. This has kept my code nice and organized, but I'm worried that it's killing the efficiency of my code.

任何人都可以确认是否是这种情况吗?

Can anyone confirm if this is the case?

此外,我的所有代码都包含在与UI分开的类中.这样会使事情运行的速度比我的代码包含在Form1.cs文件中的速度明显慢吗?

Also, I have all of my code contained in a class separate from my UI. Is this going make things run significantly slower than if I had my code contained in the Form1.cs file?

大约需要计算95000个点,每个点通过7种方法进行额外的计算.

There are about 95000 points that need to be calculated, each point goes through 7 methods that does additional calculations.

推荐答案

您是否尝试过使用任何性能分析或性能工具来缩小发生这种情况的原因?

Have you tried any profiling or performance tools to narrow down why the slowdown occurs?

它可能会向您显示重构代码和提高性能的方法.

It might show you ways that you could use to refactor your code and improve performance.

另一个用户提出的这个问题有几个选项可供您选择:

This question asked by another user has several options that you can choose from:

好的.Net Profilers

这篇关于有许多方法可以杀死代码速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆