Matthew Toseland wrote:
> Hmmm, I was assuming that currentValue() wouldn't be called often, but in 
> fact 
> we call it every time we log ... IMHO it's not a big deal either way. Even 
> with the impl you mention, we would still have the memory leak, unless we 
> spend a lot more memory on an LRU...

There's a nice algorithm for calculating a running estimate of the 
median in constant time and space on page 5 of this paper:

http://www.eng.tau.ac.il/~dimaf/Publications/FS06.pdf

Essentially, increment the estimate if the sample's greater than the 
estimate, decrement the estimate if the sample's less than the estimate, 
and decrease the size of the increments if the sample's close to the 
estimate.

Cheers,
Michael
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to