From: Lennart Poettering Date: Thu, 29 Oct 2009 00:49:40 +0000 (+0100) Subject: smoother: add comments about optimization recommendations from Jason Newton X-Git-Tag: v0.98-dev~333 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2edb4df175ee69e386ec3923e69af6899f55e2eb;p=platform%2Fupstream%2Fpulseaudio.git smoother: add comments about optimization recommendations from Jason Newton --- diff --git a/src/pulsecore/time-smoother.c b/src/pulsecore/time-smoother.c index d6c3787..1371ad5 100644 --- a/src/pulsecore/time-smoother.c +++ b/src/pulsecore/time-smoother.c @@ -196,6 +196,13 @@ static double avg_gradient(pa_smoother *s, pa_usec_t x) { int64_t ax = 0, ay = 0, k, t; double r; + /* FIXME: Optimization: Jason Newton suggested that instead of + * going through the history on each iteration we could calculated + * avg_gradient() as we go. + * + * Second idea: it might make sense to weight history entries: + * more recent entries should matter more than old ones. */ + /* Too few measurements, assume gradient of 1 */ if (s->n_history < s->min_history) return 1;