I tested the swap on "CM10.x" by volk204 but there isn't a reason it shouldn't work on other rom versions.
version 1.0 13/11/2013 18:29 GMT+2
I experienced some lag with my wave due to its low ram memory. So after testing a few things i found myself more comfortable with setting up swapfile on sd card(NAND memory); after few minutes this terminal becomes really smooth. (It strangely is faster than setting it up on the phone memory, atleast for me)
The idea is mine, but checking around i found that many other script were made. I got the sleep line to boot part idea from "Defiant07 @ XDA" (http://forum.xda-developers.com/show....php?t=2359182). Everything else (as simple it is it's all mine)
Swap is the *nix term for virtual memory, that maybe many are familiar with on windows.
You set up a partition/file and use that as virtual memory. It will be much slower than real ram, but it will be much faster than reloading everything from disk everytime.
#!/system/bin/sh # This script was authored by Defiant07 @ XDA. If you use/redistribute it, eve$ # Thanks to zeppelinrox most of all, but also many thanks to dk_zero-cool & gu5$ # Much thanks to pikachu01 @ XDA for permission to use the sysctl tweaks from T$ # Read Karl Marx! # Nearly entirely modified by skyglow swapfile="/storage/sdcard0/swapfile" #swapsize in KB swapsize=524288 swappiness=90 vfs_cache_pressure=100 dirty_background_ratio=5 dirty_ratio=20 dirty_writeback_centisecs=500 dirty_expire_centisecs=200 while [ ! "`ps | grep -m 1 [a]ndroid`" ]; do sleep 10; done if [ ! -f "$swapfile" ]; then dd if=/dev/zero of=$swapfile bs=1024 count=$swapsize mkswap $swapfile fi # sleep 30 # mkswap $swapfile swapon $swapfile busybox sysctl -e -w vm.swappiness=$swappiness busybox sysctl -e -w vm.vfs_cache_pressure=$vfs_cache_pressure busybox sysctl -e -w vm.dirty_background_ratio=$dirty_background_ratio busybox sysctl -e -w vm.dirty_ratio=$dirty_ratio busybox sysctl -e -w vm.dirty_writeback_centisecs=$dirty_writeback_centisecs busybox sysctl -e -w vm.dirty_expire_centisecs=$dirty_expire_centisecs exit 0
Superuser rights on terminal to change permission and copy this file
1) set up "swapfile" field to where you want your swap
2) set up "swapsize" field to an appropriate value in KB! ( i think you should try values over 307200 => 300MB to have performance improvements)
(SD or NAND version)
position=bada application partition
How to install
1) Download the right zip from this page
2) Extract the file from the zip
3) Upload the file in some way on the phone
4) Become superuser
5) move it to "/system/etc/init.d"
6) this file should keep hits name "99myswap"
7) change permissions of "99myswap" to 755
8) change its rights to "root:shell"
9) done, next reboot your swap will be set up automatically
How to check if swap is activated:
Swap filename should be displayed with the right size
[ADDED DEBUG SCRIPT]