Basic data compression to save watch memory use.

Good morning everyone, 

In one of my applications I have a very large array that is full of float values,  ( up to around 150 float values ), and I would like to convert each array float into a 4 digit  value ( always with two decimal places, and allways with value less that 99, and always an integer ), and then combine several of the array values into a single number. 

For example [1.2344667,24.565544,32.342354,77.3424234]   would become 0123245732347734

My array of 150 float values, would then become an array of 33 numbers..... and I could have lots of these arrays.

I need to retain accuracy with the number, so my question is how many of these 4 digit, non signed , non decimal  numbers should I be able to group and store as non signed integers?

I might have for example, 200 arrays each with 150 values, and the watch memory cannot cope with that number of vlaues.

  • That's true, I also experienced it today. When I tried to load a long array it failed with out of memory error, but when I split it to 3 jsonData arrays, and loaded them one by one (and kept all of them in the memory in one big array) then it worked. I think when you load a json object then the parsing uses lot of memory. We also know this is true when we read properties.

  • So here is a question.... What is the largest string I can store in Monkey c, to then transmit as a value in json?  It kind of is now dawning on me that for long datasets ( with say 100 values  per set, and 300 sets), it would be easier to parse and deparse if i simply ended up with a 200 character long compressed string rather that 5  longs with 5 sets of decompression code needing to be added. 

  • I don't know if there's a theoretical max size, but even if there was it doesn't matter because you'll get to practical maximum earlier with the main limiting factors: which device you run at (memory limit differs per device) and your app (it's code, data size and also how much free memory you have at the time you want to load the string) So just try it out!