1

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.

tcrat
  • 11
  • 2
    Why does faster method become slower? Can you give an example? – Arpan Mar 24 '15 at 09:00
  • The data you've given shows no indication that the "chunk" method should ever be slower than the "all-at-once" method. Perhaps there is start-up or finish time that balloons with large data sets? Maybe your timing mechanism can separate different stages of your calculations to verify where the source of the slowness is. – abiessu Mar 24 '15 at 14:49

0 Answers0