Performance Tips
Final Update
Janjan has already included in the new rom all of these changes. So no need to keep reading this post.
I'll leave it here in case it helps someone with other type for smartwatch.
Great job @janjan keep it going.
------------------- Original Post -------------------------
Here are my two cents on performance on this device.
The Problem
Like in many android devices one of the main issues ( i learned this with old phones ) is the RAM and Swap.
While switching apps or opening new ones the following events happen (please remember this is a linux based OS so all of this assumptions are based on Linux experience)
1. App open request happens
2. Os checks if app is running if it is is switches to it
2.a If app is in RAM it loads it from there
2.b if its not it loads it from the swap to the RAM and then loads it from there (less expensive than reopening the app)
3. If app is not running it start it (running all the initialization procedures that can be very expensive in some apps) and gets the app to RAM
Now, if at any point of that process the RAM is full, the OS will dump another app to Swap. If the swap is full the OS will dump another (least used app) completely out of the system stopping it and therefore having to reopen it entirely later on (expensive process).
Ok. Now that this is clear lets see the Ticwatch.
The available RAM is less than 512Mb. After the system boots and all the Google services, google play, keyboard services, assistant, etc are loaded we end up with less than 100Mb available. Enough to open two apps. One of them being the launcher, "wearable.app". After this the thing start swapping. Right?.....Wrong!!!
See, there is no swap on the device. therefore opening any app will force another one out of the system completely stopping it and having to restart it later on (EXPENSIVE for CPU and Battery). This includes the wearable app. Your watchface.
One of the apps really capable of doing this is Google Play since it just LOVES RAM. It will kick everythinbg out of RAM pretty much, including your watchface. And since it runs background processes (like app updating) the OS will find hard to kick Google Play out of RAM as well.
I will not post more examples and reasons why Swap is important. But I will post the solution
The solution
USE AT YOUR OWN RISK
Creating a swap file will allow us to extend the maximum amount of available RAM. We are aware that RAM disk is slow, and should be avoided at all cost, but in this case it is quite beneficial. Here is how to enable it
1. Have the custom ROM installed
2. Have the latest kernel installed
3. Have developer options enabled
4. Have busybox and magisk installed
Run the following commands on your computer
adb devices (device should show up there if properly connected)
adb shell
su (approve access on device itself)
fallocate -l 256M /sbin/.magisk/mirror/data/swapfile
mkswap /sbin/.magisk/mirror/data/swapfile
swapon /sbin/.magisk/mirror/data/swapfile
sysctl vm.swappiness=60
Now, some notes
1. The 256Mb is a (so far) arbitrary number I came up with. Over monitoring it closely it seems that 256Mb is enough. Change this to your liking. You can check the amount of used swap by running the command top while in adb shell
2. The selected swappinesss is the default for a desktop computer, it may require tweaking but so far seems ok.
3. Updating apps with the play store still uses a LOT of CPU, but is way more responsive now and I would recommend updating apps only when you are not going to need the watch or while charging.
4. Use this alongside kernel auditor and ondemand governor with 4 cores enabled and 1.2Ghz as max cpu frequency.
5. After reboot swap will be lost and you will have to set it up again. Please note that I did it this way since i'm still testing this.
6. Your device may have a reduces SD life and could be detrimental if the manufacturer used a low grade chip
The Result
Well. Apps NEVER get relaunched.
1. They never get stopped in the first place in order to make space for other apps
2. They switch WAY faster since they are either in RAM or in SWAP
3. First launch of any app is faster since other apps don't need to be stopped first
4. Finally the TicWatch Pro is a useful device. I no longer think that getting a Google Authenticator code will be faster if i just use my phone.
I hope this helps you all.
I'm available to answer your questions on European (i'm awake) times.
---------- Post added at 06:57 PM ---------- Previous post was at 06:27 PM ----------
I recorded a video to show the snappiness of the device now.
Note about the video. Some apps where previously opened (therefore where on RAM or the new shinny SWAP)
other apps like the flashlight, weather and Magisk, where not. but you can see that after opening them they reopen (switch back) pretty much instantly.
During the video the Swap usage was 140Mb.
Link to video - Please remove spaces since XDA does not allow me to post links XD:
https ://youtu.be/UVk4JLqC8Do
One of the main things I realized is that after launching the google assistant (hold main button 1 sec) I can actually relaunch it 100 times after that (including app witching) and still get my response to (turn on the lights in the house, or how is the weather in less than 1 sec)
This is a must try
------------------------------------------------------ Update 1 -----------------------------------------------------------
After testing, using swap seems to affect battery usage on a rate of about 10% drain (depends on your usage).
The main reason could be the fact that now we are using the storage a lot more, and using the storage means that this chip will consume more power.
my watch have been running now for 2 days (with 1 battery charge in between) and I had not performance issues. I was able to work with notifications, receive phone calls, use the assistant, google fit, etc.
------------------------------------------------------ Update 2 -----------------------------------------------------------
I realized that after having every app running and not having to boot them again the device battery is actually well improved. I'm doing 36-48h now.
Also realized that finally the Google assistant is useful. Responsive and helpful
I reduced the amount of cache to 256Mb and updated the script. Seems to be enough for a custom watchface Google fit, assistant, calendar, weather, hr monitor and Google play to run at the same time.
Do not try (as I did), to run 1Gb of swap. You will never get to use it and since you need to allocate all the space at once you cannot install more apps. The device will become unresponsive and and connection fails at this point for a reason. Causing weird connection and disconnections
------------------------------------------------------ Update 3 -----------------------------------------------------------
How to make it persistent after reboot
Here is small script in oder to make the swap permanent
I did not find a way to use the fstab or the init.rc since none of them seem to be available in Android
It seems that is available in some devices but not on other. But, since we also need Magisk for the actual swap we can also use it to run the script using the handy service.d folder
Script (save to a remount_swap.sh file in your pc, you can do this with a text editor, just make sure that you don't accidentally have a .txt at the end)
#!/system/bin/sh
sleep 10
sysctl vm.swappiness=60
swapon /sbin/.magisk/mirror/data/swapfile
How to copy the script
adb push <path_to_your_script>\remount_swap.sh /storage/emulated/0/
adb shell
su
cd /storage/emulated/0/
mv remount_swap.sh /sbin/.magisk/img/.core/service.d/
cd /sbin/.magisk/img/.core/service.d/
chmod +x remount_swap.sh
adb reboot
Final Update
Janjan has already included in the new rom all of these changes. So no need to keep reading this post.
I'll leave it here in case it helps someone with other type for smartwatch.
Great job @janjan keep it going.
------------------- Original Post -------------------------
Here are my two cents on performance on this device.
The Problem
Like in many android devices one of the main issues ( i learned this with old phones ) is the RAM and Swap.
While switching apps or opening new ones the following events happen (please remember this is a linux based OS so all of this assumptions are based on Linux experience)
1. App open request happens
2. Os checks if app is running if it is is switches to it
2.a If app is in RAM it loads it from there
2.b if its not it loads it from the swap to the RAM and then loads it from there (less expensive than reopening the app)
3. If app is not running it start it (running all the initialization procedures that can be very expensive in some apps) and gets the app to RAM
Now, if at any point of that process the RAM is full, the OS will dump another app to Swap. If the swap is full the OS will dump another (least used app) completely out of the system stopping it and therefore having to reopen it entirely later on (expensive process).
Ok. Now that this is clear lets see the Ticwatch.
The available RAM is less than 512Mb. After the system boots and all the Google services, google play, keyboard services, assistant, etc are loaded we end up with less than 100Mb available. Enough to open two apps. One of them being the launcher, "wearable.app". After this the thing start swapping. Right?.....Wrong!!!
See, there is no swap on the device. therefore opening any app will force another one out of the system completely stopping it and having to restart it later on (EXPENSIVE for CPU and Battery). This includes the wearable app. Your watchface.
One of the apps really capable of doing this is Google Play since it just LOVES RAM. It will kick everythinbg out of RAM pretty much, including your watchface. And since it runs background processes (like app updating) the OS will find hard to kick Google Play out of RAM as well.
I will not post more examples and reasons why Swap is important. But I will post the solution
The solution
USE AT YOUR OWN RISK
Creating a swap file will allow us to extend the maximum amount of available RAM. We are aware that RAM disk is slow, and should be avoided at all cost, but in this case it is quite beneficial. Here is how to enable it
1. Have the custom ROM installed
2. Have the latest kernel installed
3. Have developer options enabled
4. Have busybox and magisk installed
Run the following commands on your computer
adb devices (device should show up there if properly connected)
adb shell
su (approve access on device itself)
fallocate -l 256M /sbin/.magisk/mirror/data/swapfile
mkswap /sbin/.magisk/mirror/data/swapfile
swapon /sbin/.magisk/mirror/data/swapfile
sysctl vm.swappiness=60
Now, some notes
1. The 256Mb is a (so far) arbitrary number I came up with. Over monitoring it closely it seems that 256Mb is enough. Change this to your liking. You can check the amount of used swap by running the command top while in adb shell
2. The selected swappinesss is the default for a desktop computer, it may require tweaking but so far seems ok.
3. Updating apps with the play store still uses a LOT of CPU, but is way more responsive now and I would recommend updating apps only when you are not going to need the watch or while charging.
4. Use this alongside kernel auditor and ondemand governor with 4 cores enabled and 1.2Ghz as max cpu frequency.
5. After reboot swap will be lost and you will have to set it up again. Please note that I did it this way since i'm still testing this.
6. Your device may have a reduces SD life and could be detrimental if the manufacturer used a low grade chip
The Result
Well. Apps NEVER get relaunched.
1. They never get stopped in the first place in order to make space for other apps
2. They switch WAY faster since they are either in RAM or in SWAP
3. First launch of any app is faster since other apps don't need to be stopped first
4. Finally the TicWatch Pro is a useful device. I no longer think that getting a Google Authenticator code will be faster if i just use my phone.
I hope this helps you all.
I'm available to answer your questions on European (i'm awake) times.
---------- Post added at 06:57 PM ---------- Previous post was at 06:27 PM ----------
I recorded a video to show the snappiness of the device now.
Note about the video. Some apps where previously opened (therefore where on RAM or the new shinny SWAP)
other apps like the flashlight, weather and Magisk, where not. but you can see that after opening them they reopen (switch back) pretty much instantly.
During the video the Swap usage was 140Mb.
Link to video - Please remove spaces since XDA does not allow me to post links XD:
https ://youtu.be/UVk4JLqC8Do
One of the main things I realized is that after launching the google assistant (hold main button 1 sec) I can actually relaunch it 100 times after that (including app witching) and still get my response to (turn on the lights in the house, or how is the weather in less than 1 sec)
This is a must try
------------------------------------------------------ Update 1 -----------------------------------------------------------
After testing, using swap seems to affect battery usage on a rate of about 10% drain (depends on your usage).
The main reason could be the fact that now we are using the storage a lot more, and using the storage means that this chip will consume more power.
my watch have been running now for 2 days (with 1 battery charge in between) and I had not performance issues. I was able to work with notifications, receive phone calls, use the assistant, google fit, etc.
------------------------------------------------------ Update 2 -----------------------------------------------------------
I realized that after having every app running and not having to boot them again the device battery is actually well improved. I'm doing 36-48h now.
Also realized that finally the Google assistant is useful. Responsive and helpful
I reduced the amount of cache to 256Mb and updated the script. Seems to be enough for a custom watchface Google fit, assistant, calendar, weather, hr monitor and Google play to run at the same time.
Do not try (as I did), to run 1Gb of swap. You will never get to use it and since you need to allocate all the space at once you cannot install more apps. The device will become unresponsive and and connection fails at this point for a reason. Causing weird connection and disconnections
------------------------------------------------------ Update 3 -----------------------------------------------------------
How to make it persistent after reboot
Here is small script in oder to make the swap permanent
I did not find a way to use the fstab or the init.rc since none of them seem to be available in Android
It seems that is available in some devices but not on other. But, since we also need Magisk for the actual swap we can also use it to run the script using the handy service.d folder
Script (save to a remount_swap.sh file in your pc, you can do this with a text editor, just make sure that you don't accidentally have a .txt at the end)
#!/system/bin/sh
sleep 10
sysctl vm.swappiness=60
swapon /sbin/.magisk/mirror/data/swapfile
How to copy the script
adb push <path_to_your_script>\remount_swap.sh /storage/emulated/0/
adb shell
su
cd /storage/emulated/0/
mv remount_swap.sh /sbin/.magisk/img/.core/service.d/
cd /sbin/.magisk/img/.core/service.d/
chmod +x remount_swap.sh
adb reboot
Last edited: