tidepool-org/tideline — pull request #79 by cheddar (2014-04-11 18:43:22+00:00)
Title: Fix check in oneday.js and performance improvements

In looking over the code in preprocessing.js I noticed that oneday.js's check for no data wasn't actually doing what we hoped it would. a is an object and the length of an object is undefined by default, so all it was doing was checking the truthyness of a.

As I was looking over the code, I also noticed that preprocessing.js was doing a lot of redundant iterations over the array of data as well as a lot of superfluous equality checks. So I re-wrote it to try to expose a slightly different style of programming that I know to be faster, believe to be more succinct, and also believe to be easier to maintain. There are still a lot of copies of arrays that are happening, but one thing at a time.

@jebeck this is a provisional PR, mostly to show a different style of code and see if you agree that it is an improvement. This should be done after #75 (I branched off of that). If you want to talk about the changes, lmk.