History iterator how do you guys deal with it?

To be honest for example taking the iterator for a period of 6 hours and then looping through the results can basically already be over 1500us in the profiler on instinct watches. I'm really trying to avoid to do any thing that can cause noticable lag on Instinct watches. But with the history iterator it pretty much seems unavoidable and best thing I can do is to only run this loop at moments there's the least change a user would try to do something else like going to glances view or something. But I just don't like that there's always that slight chance where the iterator loop runs and the user might be wanting to do something else at the same time..

Wonder how you guys running through the iterator if it generates so many results the loop will take so long it actually creates noticable delay? 

  • What are you trying to achieve? Why do you loop over the results?

  • Draw a graph of course :D

  • Are you running into an issue going through the values?  I do this with different history vales from SensorHistory, where the only real limit I have is the width of the graph.  If that's 200, I only use the newest 200 samples, for example.

  • Well I actually show graphs of lets say the last 6 hours so it can be more samples. I divide the samples into groups of how many points I can show on the graph and then take the average of each group and that's what I plot on the graph. But yeah not really running into issues, but according the profiler this can take up to 2000us sometimes to iterate through everything. It's not a big deal because I only do it for example once on wakeup and draw everything to an offscreenbuffer. But I do notice that sometimes if I wake up my watch and immediately press menu button there is like a tiny delay, probably because graph is still looping. It's not a huge deal, but currently I'm trying to make my WF feel as snappy as possible. So really trying to avoid anything that takes more then 500us. Even if it's run only once a while. 

    Currently looking into a way where I retreive the full 6 hours of data only once at first startup and then just on every wakeup add to the final array the missing values since last update (retreive from iterator tme period now minus last updated). But yeah getting pretty complicated as I dividie the data into plot groups etc. lol. 

    Also on other watches is not causing a delay at all, but am working specifcally on Instinct and that watch has like the slowest processor ever made lol 

  • 2000us is 2000 microseconds, or 2 milliseconds, so very quick