Best practices - performance, memory management, optimization

Can you please share what your best practices are in terms of

Memory management and
Optimization for performance

I have now had two users providing feedback that my watchface slows down the watch overall.
For example apparently when the user wants to start training and pressing start / stop takes a moment to appear, or nothing happens and the user has to click twice. Apparently shows with other functions also.

Doesn't the watchface completely unload and free up memory when the user performs actions outside the scope / view of a watchface?

The description above does not make sense to me, but I believe that since it has been reported, I need to investigate at least.

For starters I am going to try and load resources a bit smarter. I know that I load all various bitmaps for example different battery levels all at once in the onLayout. But I might just need to load just the singel one on every onUpdate.

Regards,

H
  • Are you seeing this on a device? If so, which ones? We will look into getting this corrected in the simulator.




    Not tested on device. Haven't taken the effort to do debugging on actual device.
    Trusted the simulator, but perhaps that was a mistake to assume behaviour on simulator == behaviour on device
  • Array questions.

    Example code:

    var array1=new[10];
    var array2=array1;


    Question 1: array2 is a copy of array1? Or both share the same array (i.e array2 is just another reference of array1?

    Question 2: if I call a function and pass an array to it as an argument, then the array will be passed to function as a new copied array? Or just an array reference?

    I can not test now as I do not have my laptop with Connect IQ IDE with me.