Many methods kill code speed?

I am creating an application that will be much slower than it should be (the process takes 4 seconds, when it should only take 0.1 seconds, which is at least my goal).

I have a bunch of methods that pass an array from one to another. It helped my code beautifully and organized, but I worry that it kills the efficiency of my code.

Can anyone confirm if this is the case?

In addition, I have all of my code contained in the class, separate from my user interface. Will this make things work much slower than if I had the code contained in the Form1.cs file?

Edit: There are about 95,000 points that need to be calculated, each point goes through 7 methods that perform additional calculations.

+2
source share
7 answers

Have you tried any profiling or performance tools to narrow down the reasons for the slowdown?

This may show you ways you could use to reorganize your code and improve performance.

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

Good .Net Profiles

+11
source

. , , - . , , , , , .

, , 7 , 7 , , 95000 .

+9

, ( ). . , , , - , , , .

, , , , - .

. , .

+1

. -, 4 - .

+1

Array - , . . . . , , . , , , .

0

, ?

( ) ( , , ), , , .

, , , ( , ), , , .

0

(.NET 1.1), VS2010, : . ( )

Then, if you run your code from VS (no questions, even in Release mode), the VS debugger connects to your code and slows it down.

I know that for this tutorial I will be inactive, but ... Maximum performance will be achieved with unsafe operations with arrays (yes, this is UNSAFE, but when there is a deal with performance, so ...)

And the last - reorganize your code to use a minimum of methods that work with your arrays. This will improve performance.

-1
source

All Articles