The progress bar that doesn't convey any sense of progress (was Re: ...)

John Arbash Meinel john at arbash-meinel.com
Thu Dec 10 17:13:25 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gordon Tyler wrote:
> On 09/12/2009 7:46 PM, Martin Pool wrote:
>> Oh, the other point I had was that there's almost certainly code you
>> could reuse/adapt to do this already.
> 
> Where? I only really looked at TextProgressView when I was first writing
> SimpleProgressView.
> 
>> I think the next best step would be a decaying average (what is the
>> correct name?) as John suggested.
> 
> I think I'll try John's weighted calculation first because it sounds
> simpler to implement. We can tweak the weighting as necessary.
> 

Low-pass filter?
http://en.wikipedia.org/wiki/Low-pass_filter#Algorithmic_implementation

If you look at the core line:
y[i] := α * x[i] + (1-α) * y[i-1]

I suppose they use an inverted alpha param. In that it signals how much
of the new value to use, versus how much of the old value. But, same
equation.

Since our sampling rate is not fixed, we might consider varying things
based on converting it back into a fixed sampling.

eg. start by proposing an ideal 10 samples per sec (0.1s/sample). Then
if we get a sample at 1s, you can break that into 10 mini-samples, and
average across them. I'm sure there is a closed form solution that
involves a couple exponentials, but I don't really feel like working out
the math. (y[i] = a x[i] + ? x[i-1] + ? x[i-2] + ... ? y[i-10]). And
consider that all of those x's are the same value, to get

y[i] = (a + ? + ? + ?) x[i] + ...

We could... actually break the tnow - tprev into steps and run the
filter in a loop:

for repeat in delta / 0.1:
  avg = alpha * avg + (1-alpha) * cur_rate

Anyway, something is better than nothing, give it a shot and see if you
like what you get.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkshLDUACgkQJdeBCYSNAAM2lwCfVuM90Szn8f2OHPC3lKtbA9x4
Jw0An2xeQO6cD/zUVRKB4/Og8ImNaLt8
=Ecps
-----END PGP SIGNATURE-----



More information about the bazaar mailing list