i am calculating large data sets with program i wrote and i have two different methods to do this. The first way is to calculate it all at once and the second way to calculate result is to do it in smaller chunks which is faster with short input lengths. The execution time is growing linearly when input size grows.
Now, if the calculation which is done in smaller chunks is done in 3 steps and they take, for example 10, 15 and 14 seconds with input length x and the calculation which calculates all at once does it in, say, in 90 seconds. If we double x, so that we have 2x, the calculation times are, 20, 30, and 28 seconds and 180 seconds.
Now the question: How do i calculate the input length which results equal total execution times for both ways to calculate the result ? For instance, 20 + 30 + 28 = 78 is less than 180, but at some point, when input length grows, faster method actually becomes slower.
I could solve this easily by trying different values of course but i'm after more elegant solution.