Visual C++ function suddenly 170 ms slower (4x longer) -


The last few months I take images from the camera and are working on a Visual C ++ project to take action Is for To date, it has taken about 65 MSs to update the data, but now it has suddenly increased a lot. What happens: I start my program and before 30 or so iterations show it as expected, then suddenly loop time increases from 250 ms to 65 ms

Strange thing, at the time of each task after. I came to know that the part of the code that is causing the recession is quite basic and it has not been modified in a month. The data which goes into it is unchanged and identical to every visit but execution time which is at least 1 ms initially, while the rest of the code is still performing as expected, increases to 170 ms (time Terms).

Actually, I am calling the same function more and more, for the first 30 calls, as it should, there is no obvious reason for it. It is also worth noting that it may be a sudden change in execution time, no, gradual increase.

What can be done with it? The code is leaking up some memory (~ 50KB / s), but about 4x is not nearly enough for assurance of recession, if someone has any ideas, then I would love to hear them!

EDIT: Wow, that was fast! Here is the code (some mathematics from zero) which seems to slow down. I know that this is a function where computational time will grow faster if you increase the number of lines here that the same data is with this 30 iterations After slowing down

  Zero CameraManager :: IntersectLines () {// Two custom classes: TMaths math. Line line 1, line2; While (lines.size ()> 0) {// current line line save 1 = lines [0]; // Then remove it from the list lines. Defeat (lines.begin ()); CvMat * aPoint; For (int i = 0; i  

}

Is it possible that leaks After a certain amount of memory, your computer has to start paging stuff / out?

Edit: As suggested in the question comment, leaking a certain amount of things can start knocking things out of CPU cache, which will slow down anything. It would be a good idea to either fix the memory leak or post the code to see it here.

Editing 2: You call some functions in that loop. Do they do anything other than simple arithmetical calculations?


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -