On Saturday, June 6, 2015, Tim Hill <
drtimhill@gmail.com> wrote:
I'm not sure what Andrew's specific usecase is, but imagine timeseries data indexed by some non-integer timestamp format.
Yes, I was guessing it was something like that.
Yes. Time series data, for me. That's why I'm mostly interested in integers (samples/scale). I also imagine that floats would make it more difficult to implement and therefore not worth it.
But generally, if all integers were stored in order, then some nice things become possible / necessary.
Things like: "nexti", "firsti", "lasti", and some way to get the index at or lower than some specified value.
I use a single sequence and a table with the index / time value at [1] and the vale at [2]. So every key value is indirected once, simply because I need them to be in order. I use a simple binary search function, given a desired time value, returns: index (of sequence), value, next_value. I use insert/remove to keep everything together. I couldn't see a way to implement something faster in C.
-Andrew