For complex algorithms, how do you rate its performance?

Suppose now that you have narrowed down where the typical bottlenecks in your application are. To the best of your knowledge, this may be the batch process that you perform to reindex your tables; These can be SQL queries that are executed on your dated trees; it could be an XML sort of several hundred composite objects. In other words, you might have something like this:

public Result takeAnAnnoyingLongTime(Input in) { // impl of above } 

Unfortunately, even after you have identified your bottleneck, all you can do is drop it. There is no easy solution.

How do you rate the performance of your bottleneck so that you know that your fixes are directed in the right direction?

+4
source share
7 answers

Two points:

  • Beware of the notorious downtime optimization problem. (For example, see the optimization description under the heading "Porsche-in-the-park-lot".) That is, just because a procedure is suitable for a considerable amount of time (as shown by profiling) does not assume that it is responsible for slow performance, how it is perceived by the user.

  • The greatest increase in performance often comes not from this smart tuning or optimization to the implementation of the algorithm, but from the understanding that, in general, there is a better algorithm. Some improvements are relatively obvious, while others require a more detailed analysis of the algorithms and, possibly, a significant change in the data structures. This may include discarding processor time for I / O time, in which case you need to make sure that you are not optimizing just one of these measures.

Returning to the question asked, make sure that everything that you measure is what the user is actually experiencing, otherwise your efforts can be a waste of time.

+5
source
  • Profile
  • Find the top line in the profiler, try to do it faster.
  • Profile
  • If this worked, go to 1. If this did not work, go to 2.
+3
source

I would measure them using the same tools / methods that allowed me to find them in the first place.

Namely, the time of recording and recording calls takes place everywhere. If the numbers start to decline, then you can just do the right thing.

+2
source

As mentioned in this msdn column , performance tuning is compared to the Golden Gate Bridge mapping job: as soon as you finish drawing the whole thing, it's time to go back to the beginning and start again.

+2
source

It's not a problem. The first thing you need to understand is that measuring performance is not how you find performance issues. Knowing how slowly something does not help, you will find out why. You need a diagnostic tool, and a good one. I had a lot of experience with this, and this one is the best method. It is not automatic, but it works around most profilers.

+1
source

This is an interesting question. I don’t think anyone knows the answer. I believe that a significant part of the problem lies in the fact that for more complex programs no one can predict their complexity. Therefore, even if you have profiling results, it is very difficult to interpret it in terms of changes that must be made to the program, because you do not have a theoretical basis for the optimal solution.

I think this is the reason why we so inflated the software. We only optimize so that fairly simple cases work on our fast machines. But as soon as you put these things into a large system or use a larger input order, the wrong algorithms used (which were previously invisible both theoretically and practically) will begin to demonstrate their true complexity.

Example. You create a string class that handles Unicode. You use it somewhere, like computer processing XML, where it really doesn't matter. But Unicode processing is there, taking part in the resources. The string class itself can be very fast, but call it a million times and the program will be slow.

I believe that most of the ongoing bloat of software is of this nature. There is a way to reduce it, but this is contrary to OOP. There is an interesting book There is an interesting book about various methods, it is memory-oriented, but most of them can be returned to get more speed.

0
source

I would single out two things:

1) what is the difficulty? The easiest way is to plot the time spent on erasing input. 2) how is this related? This is a memory, disk or IPC with other processes or machines or ..

Now point (2) is easier to solve and explain: many things go faster if you have more RAM or a faster computer or faster disks or switch to a gigantic network or such. If you identify your pain, you can put some money in the equipment to make it portable.

0
source

Source: https://habr.com/ru/post/1277431/


All Articles