Predict C ++ runtime

How to predict the operating time of a program in C ++ if the program performs different functions (working with a database, reading files, parsing XML, and others)? How do installers do this?

+3
source share
11 answers

They do not predict time. They count the number of operations that must be performed in total operations.

+8
source

You can predict time by measuring and evaluating. Of course, the quality of the forecasts will be different. And BTW: The word "predict" is true.

, : 10 , 90 90 . .

.

+6

- , .

:

  • - n // , m.
  • , - n , m, t , , , u.
+5

:

, . .. , . -:

for(int i=0; i<num_files_to_load; ++i){
    files.push_back(File(filepath[i]));
    SetProgressBarLength((float)i/((float)num_files_to_load) - 1.0f);
}

. , , / . , , , - .

:

N , , , , . . , . - , - . , , , . , .

+4

.

?

- . , . , , , .

+4

, . , Partial rmn, .

, (, , db , , ).

+1

, op, .

​​ 3D- , , , . , . ( 10-15 /, 10-20 )

+1

.

, , , , , 1%, - , 1% 100, . , , , - .

0

, .

.

.

, ( , , .. ..) + . (, , , ), .

, , , - , , :)

0

You must make an estimate of the time required for the different stages of the program. For example: reading files - 50, working with a database - 30, working with a network - 20. Ideally, it would be nice if you made some progress callback at all these stages, but it requires encoding the calculation of progress in iterations of the algorithm,

-1
source

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


All Articles