I need to find the total timings for the execution of a program over different inputs. The program reads some data and writes it into another file. The values of the data value and the size of the data are different every time.
I want to find how long it will take in general for all size of data.
Is the algorithm for finding this based on the total timings of the program for a single execution?
For Example, if I know
for single execution
a.program - execution time 1.2sec
- its create file 100 kb file
Can I find out how long it will take for n executions, on a different data size?
I don’t quite understand your question, but I believe that what you’re asking is how to figure out the execution time of a program in advance of running it.
This is related to the halting problem. The halting problem is intractable.
Apologies if I am misunderstanding your question.
Edit: To respond to your clarification, there is no general algorithm for extrapolating runtime for larger inputs from runtime for smaller inputs. Analysis of algorithms is very tricky business. There are heuristics that you can use. For example, you could compute runtime on inputs of varying “size” (say, 10, 100, 1000, 10000) and try to fit a curve to the function “size” -> runtime.