S
S
Sergey Sokolov2014-12-10 18:12:29
JavaScript
Sergey Sokolov, 2014-12-10 18:12:29

How to predict intermediate progress for a stepwise task?

On the site, a long-running task is performed in steps: a series of ajax calls. Each is performed for 12–18 seconds. The user wants to show something frequently updated, predictable, like live progress, in small steps.
I tried to do it linearly : I assumed that progress = f(time)it was simple k * time. When the next response arrives, this k is adjusted based on the last point received. fiddle - imitation, the execution time of the next pack is random + - 4 sec.
It seems that linearity is the wrong approach: if a real step suddenly slows down, compared to the previous ones, my progress rolls back when the real data finally arrives.
How can one predict progress relatively realistically based on discrete steps?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2014-12-10
@gbg

Take time with an additional margin, and let progress approach the next milestone not at a linear speed, but with certain pulsations of this speed.
And in order to guess, you need to have statistics, and the more extensive it is, the more accurate guessing will be.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question